Initial commit
This commit is contained in:
41
components/chantiers/ChantierStatusBadge.tsx
Normal file
41
components/chantiers/ChantierStatusBadge.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user