35 lines
826 B
TypeScript
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>
|
|
);
|
|
}
|