siakad-itm/resources/js/components/student-status-badge.tsx
Yoga Pangestu 1012127196
Some checks failed
tests / ci (pull_request) Has been cancelled
feat: add GenderBadge and StudentStatusBadge components; update user columns to utilize new badges
2026-08-26 00:51:22 +07:00

35 lines
826 B
TypeScript

import { Badge } from '@/components/ui/badge';
type StudentStatusBadgeProps = {
status: string | null | undefined;
};
const StudentStatusLabels: Record<string, string> = {
active: 'Aktif',
on_leave: 'Cuti',
graduated: 'Lulus',
dropped_out: 'Drop Out',
};
const StudentStatusVariants: Record<
string,
'default' | 'secondary' | 'destructive' | 'outline'
> = {
active: 'default',
on_leave: 'secondary',
graduated: 'outline',
dropped_out: 'destructive',
};
export function StudentStatusBadge({ status }: StudentStatusBadgeProps) {
if (!status) {
return <span className="text-muted-foreground">-</span>;
}
return (
<Badge variant={StudentStatusVariants[status] ?? 'outline'}>
{StudentStatusLabels[status] ?? status}
</Badge>
);
}