2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { CstClass } from '@/models/rsform';
|
2024-01-06 03:15:02 +03:00
|
|
|
import { colorBgCstClass } from '@/styling/color';
|
2023-12-13 14:32:57 +03:00
|
|
|
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-28 14:04:44 +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-16 00:39:16 +03:00
|
|
|
return (
|
2024-04-01 11:13:50 +03:00
|
|
|
<div className='flex flex-col gap-1 mb-2 dense'>
|
2023-12-28 14:04:44 +03:00
|
|
|
{header ? <h1>{header}</h1> : null}
|
|
|
|
{Object.values(CstClass).map((cstClass, index) => {
|
|
|
|
return (
|
|
|
|
<p key={`${prefixes.cst_status_list}${index}`}>
|
|
|
|
<span
|
2023-12-30 19:43:24 +03:00
|
|
|
className={clsx('inline-block', 'min-w-[7rem]', 'px-1', 'border', 'text-center text-sm font-controls')}
|
2024-12-16 23:52:11 +03:00
|
|
|
style={{ backgroundColor: colorBgCstClass(cstClass) }}
|
2023-12-28 14:04:44 +03:00
|
|
|
>
|
|
|
|
{labelCstClass(cstClass)}
|
|
|
|
</span>
|
|
|
|
<span> - </span>
|
|
|
|
<span>{describeCstClass(cstClass)}</span>
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
);
|
2023-08-16 00:39:16 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default InfoCstClass;
|