import { ReactNode } from 'react'; import { Button } from './button'; import { Card, CardContent } from './card'; import { cn } from '@/lib/utils'; // FE-COMP-003: Add empty states to all list views /** * EmptyStateProps - Propriétés du composant EmptyState * * @interface EmptyStateProps */ export interface EmptyStateProps { /** * Icône à afficher au-dessus du titre * * @example * ```tsx * } title="Aucun élément" /> * ``` */ icon?: ReactNode; /** * Titre de l'état vide (requis) * * @example * ```tsx * * ``` */ title: string; /** * Description optionnelle sous le titre * * @example * ```tsx * * ``` */ description?: string; /** * Action optionnelle (bouton) à afficher sous la description * * @example * ```tsx * handleCreate(), * variant: "primary" * }} * /> * ``` */ action?: { /** Texte du bouton */ label: string; /** Fonction appelée lors du clic */ onClick: () => void; /** Variant du bouton */ variant?: 'default' | 'outline' | 'ghost'; }; /** * Classes CSS personnalisées */ className?: string; /** * Taille de l'état vide * * - `sm`: Petit (py-6, icône h-8 w-8) * - `md`: Moyen (py-12, icône h-12 w-12) - par défaut * - `lg`: Grand (py-16, icône h-16 w-16) * * @default 'md' */ size?: 'sm' | 'md' | 'lg'; } /** * EmptyState - Composant réutilisable pour afficher des états vides dans les listes * * Composant pour afficher un état vide lorsqu'une liste ou une section est vide. * Design Kodo intégré avec support pour icône, titre, description et action. * * FE-COMP-003: Add empty states to all list views * * @example * ```tsx * // État vide simple * * ``` * * @example * ```tsx * // État vide avec icône et action * } * title="Aucun message" * description="Vous n'avez pas encore de messages" * action={{ * label: "Créer un message", * onClick: () => handleCreate(), * variant: "primary" * }} * /> * ``` * * @component * @param {EmptyStateProps} props - Propriétés du composant * @returns {JSX.Element} Card contenant l'état vide stylisé */ export function EmptyState({ icon, title, description, action, className, size = 'md', }: EmptyStateProps) { const sizeClasses = { sm: 'py-6', md: 'py-12', lg: 'py-16', }; const iconSizeClasses = { sm: 'h-8 w-8', md: 'h-12 w-12', lg: 'h-16 w-16', }; return ( {icon && (
{icon}
)}

{title}

{description && (

{description}

)} {action && ( )}
); }