ConceptPortal-public/rsconcept/frontend/src/components/Shared/InfoCstClass.tsx

44 lines
1.1 KiB
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { useConceptTheme } from '@/context/ThemeContext';
import { CstClass } from '@/models/rsform';
import { colorbgCstClass } from '@/utils/color';
import { prefixes } from '@/utils/constants';
import { describeCstClass, labelCstClass } from '@/utils/labels';
2023-08-16 00:39:16 +03:00
2023-08-16 10:11:22 +03:00
interface InfoCstClassProps {
2023-12-21 00:12:24 +03:00
header?: string
2023-08-16 00:39:16 +03:00
}
2023-12-21 00:12:24 +03:00
function InfoCstClass({ header }: InfoCstClassProps) {
2023-08-27 00:19:19 +03:00
const { colors } = useConceptTheme();
2023-08-16 00:39:16 +03:00
return (
<div className='flex flex-col gap-1 mb-2'>
2023-12-21 00:12:24 +03:00
{header ? <h1>{header}</h1> : null}
{Object.values(CstClass).map(
(cclass, index) => {
return (
<p key={`${prefixes.cst_status_list}${index}`}>
<span
className={clsx(
'inline-block',
'min-w-[7rem]',
'px-1',
'border',
'text-center text-sm small-caps font-semibold'
)}
style={{backgroundColor: colorbgCstClass(cclass, colors)}}
>
{labelCstClass(cclass)}
</span>
<span> - </span>
<span>
{describeCstClass(cclass)}
</span>
</p>);
})}
</div>);
2023-08-16 00:39:16 +03:00
}
export default InfoCstClass;