Portal/rsconcept/frontend/src/components/info/BadgeConstituenta.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
import { IConstituenta } from '@/models/rsform';
import { isMockCst } from '@/models/rsformAPI';
import { colorFgCstStatus, IColorTheme } from '@/styling/color';
import TooltipConstituenta from './TooltipConstituenta';
2024-06-07 20:17:03 +03:00
interface BadgeConstituentaProps {
prefixID?: string;
value: IConstituenta;
theme: IColorTheme;
}
function BadgeConstituenta({ value, prefixID, theme }: BadgeConstituentaProps) {
return (
<div
id={`${prefixID}${value.alias}`}
className={clsx(
'min-w-[3.1rem] max-w-[3.1rem]', // prettier: split lines
'px-1',
'border rounded-md',
'text-center font-medium whitespace-nowrap'
)}
style={{
borderColor: colorFgCstStatus(value.status, theme),
color: colorFgCstStatus(value.status, theme),
backgroundColor: isMockCst(value) ? theme.bgWarning : theme.bgInput
}}
>
{value.alias}
<TooltipConstituenta anchor={`#${prefixID}${value.alias}`} data={value} />
2024-06-07 20:17:03 +03:00
</div>
);
}
export default BadgeConstituenta;