Enhance JSONGenerator: improve SelectItem layout with color indicators for better visual representation of alert types

This commit is contained in:
Bram Suurd 2024-11-13 23:13:14 +01:00
parent 599c2f8b56
commit 8b34879d66

View File

@ -538,15 +538,28 @@ export default function JSONGenerator() {
/> />
<Select <Select
value={note.type} value={note.type}
onValueChange={(value: string) => updateNote(index, "type", value)} onValueChange={(value: string) =>
updateNote(index, "type", value)
}
> >
<SelectTrigger className="flex-1"> <SelectTrigger className="flex-1">
<SelectValue placeholder="Type" /> <SelectValue placeholder="Type" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
{Object.keys(AlertColors).map((type) => ( {Object.keys(AlertColors).map((type) => (
<SelectItem key={type} value={type}> <SelectItem
{type.charAt(0).toUpperCase() + type.slice(1)} key={type}
value={type}
>
<span className="flex items-center gap-2">
{type.charAt(0).toUpperCase() + type.slice(1)}{" "}
<div
className={cn(
"size-4 rounded-full border",
AlertColors[type as keyof typeof AlertColors],
)}
/>
</span>
</SelectItem> </SelectItem>
))} ))}
</SelectContent> </SelectContent>