Skip to content

Commit

Permalink
fix: disable select when not select field
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs committed Aug 5, 2024
1 parent 38a6eb0 commit 54d16f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/filter-sphere.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const componentsSpec = {
);
return <Input className="min-w-32" onChange={handleChange} {...props} />;
},
Select: ({ value, onChange, options = [] }) => {
Select: ({ value, onChange, options = [], className, disabled }) => {
const selectedIdx = options.findIndex((option) => option.value === value);
const handleChange = useCallback(
(value: string) => {
Expand All @@ -63,9 +63,13 @@ const componentsSpec = {
[options, onChange],
);
return (
<Select value={String(selectedIdx)} onValueChange={handleChange}>
<Select
value={String(selectedIdx)}
onValueChange={handleChange}
disabled={disabled}
>
<SelectTrigger>
<SelectValue placeholder="Theme" />
<SelectValue className={className} />
</SelectTrigger>
<SelectContent>
{options?.map((option, index) => (
Expand Down

0 comments on commit 54d16f5

Please sign in to comment.