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';
|
|
|
|
|
2024-06-26 19:47:05 +03:00
|
|
|
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}
|
2024-06-26 19:47:05 +03:00
|
|
|
<TooltipConstituenta anchor={`#${prefixID}${value.alias}`} data={value} />
|
2024-06-07 20:17:03 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BadgeConstituenta;
|