mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
chore: Initial Commit
feat: Gestion des inscriptions [#1] feat(frontend): Création des vues pour le paramétrage de l'école [#2] feat: Gestion du login [#6] fix: Correction lors de la migration des modèle [#8] feat: Révision du menu principal [#9] feat: Ajout d'un footer [#10] feat: Création des dockers compose pour les environnements de développement et de production [#12] doc(ci): Mise en place de Husky et d'un suivi de version automatique [#14]
This commit is contained in:
59
Front-End/src/components/StatusLabel.js
Normal file
59
Front-End/src/components/StatusLabel.js
Normal file
@ -0,0 +1,59 @@
|
||||
import { useState } from 'react';
|
||||
import { ChevronUp } from 'lucide-react';
|
||||
import DropdownMenu from './DropdownMenu';
|
||||
|
||||
const StatusLabel = ({ etat, onChange, showDropdown = true }) => {
|
||||
const [dropdownOpen, setDropdownOpen] = useState(false);
|
||||
const statusOptions = [
|
||||
{ value: 1, label: 'Créé' },
|
||||
{ value: 2, label: 'Envoyé' },
|
||||
{ value: 3, label: 'En Validation' },
|
||||
{ value: 4, label: 'A Relancer' },
|
||||
{ value: 5, label: 'Validé' },
|
||||
{ value: 6, label: 'Archivé' },
|
||||
];
|
||||
|
||||
const currentStatus = statusOptions.find(option => option.value === etat);
|
||||
return (
|
||||
<>
|
||||
{showDropdown ? (
|
||||
<DropdownMenu
|
||||
buttonContent={
|
||||
<>
|
||||
{currentStatus ? currentStatus.label : 'Statut inconnu'}
|
||||
<ChevronUp size={16} className={`transform transition-transform duration-200 ${dropdownOpen ? 'rotate-180' : 'rotate-90'}`} />
|
||||
</>
|
||||
}
|
||||
items={statusOptions.map(option => ({
|
||||
label: option.label,
|
||||
onClick: () => onChange(option.value),
|
||||
}))}
|
||||
buttonClassName={`w-[150px] flex items-center justify-center gap-2 px-2 py-2 rounded-md text-sm text-center font-medium ${
|
||||
etat === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
etat === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
etat === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
etat === 4 && 'bg-red-50 text-red-600' ||
|
||||
etat === 5 && 'bg-green-50 text-green-600' ||
|
||||
etat === 6 && 'bg-red-50 text-red-600'
|
||||
}`}
|
||||
menuClassName="absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-10"
|
||||
dropdownOpen={dropdownOpen}
|
||||
setDropdownOpen={setDropdownOpen}
|
||||
/>
|
||||
) : (
|
||||
<div className={`w-[150px] flex items-center justify-center gap-2 px-2 py-2 rounded-md text-sm text-center font-medium ${
|
||||
etat === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
etat === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
etat === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
etat === 4 && 'bg-red-50 text-red-600' ||
|
||||
etat === 5 && 'bg-green-50 text-green-600' ||
|
||||
etat === 6 && 'bg-red-50 text-red-600'
|
||||
}`}>
|
||||
{currentStatus ? currentStatus.label : 'Statut inconnu'}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusLabel;
|
||||
Reference in New Issue
Block a user