Files
btpxpress-frontend/components/chantiers/ChantierStatusBadge.tsx
2025-10-13 05:29:32 +02:00

41 lines
954 B
TypeScript

/**
* Composant réutilisable pour afficher le statut d'un chantier
*/
import React from 'react';
import { Tag } from 'primereact/tag';
import { CHANTIER_STATUTS, ChantierStatut } from './ChantierStyles';
interface ChantierStatusBadgeProps {
statut: string;
showIcon?: boolean;
size?: 'small' | 'normal' | 'large';
className?: string;
}
const ChantierStatusBadge: React.FC<ChantierStatusBadgeProps> = ({
statut,
showIcon = true,
size = 'normal',
className = ''
}) => {
const statutKey = statut as ChantierStatut;
const config = CHANTIER_STATUTS[statutKey] || CHANTIER_STATUTS.PLANIFIE;
const sizeClasses = {
small: 'text-xs px-2 py-1',
normal: '',
large: 'text-lg px-3 py-2'
};
return (
<Tag
value={config.label}
severity={config.severity}
icon={showIcon ? config.icon : undefined}
className={`${sizeClasses[size]} ${className}`}
/>
);
};
export default ChantierStatusBadge;