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

36 lines
977 B
TypeScript
Raw Normal View History

2023-08-27 00:19:19 +03:00
import { useConceptTheme } from '../../context/ThemeContext';
2023-08-16 00:39:16 +03:00
import { prefixes } from '../../utils/constants';
2023-08-27 00:19:19 +03:00
import { getCstClassColor, mapCstClassInfo } from '../../utils/staticUI';
2023-08-16 00:39:16 +03:00
2023-08-16 10:11:22 +03:00
interface InfoCstClassProps {
2023-08-16 00:39:16 +03:00
title?: string
}
2023-08-16 10:11:22 +03:00
function InfoCstClass({ title }: 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'>
{ title && <h1>{title}</h1>}
2023-08-27 00:19:19 +03:00
{ [... mapCstClassInfo.entries()].map(
([cstClass, info], index) => {
2023-08-16 00:39:16 +03:00
return (
<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-[7rem] text-center border text-sm'
2023-08-27 00:19:19 +03:00
style={{backgroundColor: getCstClassColor(cstClass, colors)}}
>
2023-08-16 00:39:16 +03:00
{info.text}
</span>
<span> - </span>
<span>
{info.tooltip}
</span>
</p>);
})}
</div>
);
}
2023-08-16 10:11:22 +03:00
export default InfoCstClass;