mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
#591 - tags
This commit is contained in:
26
resources/js/components/color-select.tsx
Normal file
26
resources/js/components/color-select.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import React from 'react';
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { SharedData } from '@/types';
|
||||
|
||||
export default function ColorSelect({ onValueChange, ...props }: React.ComponentProps<typeof Select>) {
|
||||
const page = usePage<SharedData>();
|
||||
|
||||
return (
|
||||
<Select {...props} onValueChange={onValueChange}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select a color" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
{page.props.configs.colors.map((value) => (
|
||||
<SelectItem key={`color-${value}`} value={value}>
|
||||
<div className="size-5 rounded-sm" style={{ backgroundColor: `var(--color-${value}-500)` }}></div>
|
||||
{value}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user