ConceptPortal-public/rsconcept/frontend/src/components/Help/InfoCstStatus.tsx

38 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-08-27 00:19:19 +03:00
import { useConceptTheme } from '../../context/ThemeContext';
2023-09-21 14:58:01 +03:00
import { ExpressionStatus } from '../../models/rsform';
import { colorbgCstStatus } from '../../utils/color';
2023-08-15 21:43:15 +03:00
import { prefixes } from '../../utils/constants';
2023-09-21 14:58:01 +03:00
import { describeExpressionStatus, labelExpressionStatus } from '../../utils/labels';
2023-08-15 21:43:15 +03:00
2023-08-16 10:11:22 +03:00
interface InfoCstStatusProps {
2023-08-15 21:43:15 +03:00
title?: string
}
2023-08-16 10:11:22 +03:00
function InfoCstStatus({ title }: InfoCstStatusProps) {
2023-08-27 00:19:19 +03:00
const { colors } = useConceptTheme();
2023-08-15 21:43:15 +03:00
return (
2023-08-16 00:39:16 +03:00
<div className='flex flex-col gap-1'>
2023-08-15 21:43:15 +03:00
{ title && <h1>{title}</h1>}
2023-09-21 14:58:01 +03:00
{ Object.values(ExpressionStatus).map(
(status, index) => {
2023-08-15 21:43:15 +03:00
return (
2023-08-16 00:39:16 +03:00
<p key={`${prefixes.cst_status_list}${index}`}>
2023-08-27 00:19:19 +03:00
<span
2023-09-04 18:33:48 +03:00
className='px-1 inline-block font-semibold min-w-[5rem] text-center border text-sm'
2023-09-21 14:58:01 +03:00
style={{backgroundColor: colorbgCstStatus(status, colors)}}
2023-08-27 00:19:19 +03:00
>
2023-09-21 14:58:01 +03:00
{labelExpressionStatus(status)}
2023-08-15 21:43:15 +03:00
</span>
<span> - </span>
<span>
2023-09-21 14:58:01 +03:00
{describeExpressionStatus(status)}
2023-08-15 21:43:15 +03:00
</span>
</p>);
})}
2023-08-16 00:39:16 +03:00
</div>
2023-08-15 21:43:15 +03:00
);
}
2023-08-16 10:11:22 +03:00
export default InfoCstStatus;