Skip to content

Commit

Permalink
feat: add a placeholder and rotate icon on open
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroh committed Dec 27, 2023
1 parent 1979b45 commit c4c0905
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions modules/web/shared/ui/src/components/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,36 @@ type Props = { label: string } & Omit<ComboBoxProps<Option>, 'children'>
export function Select({ label, ...props }: Props) {
return (
<ComboBox className={'grid gap-2'} {...props}>
<Label>{label}</Label>
<div className="flex">
<Input className={'flex-grow'} />
<Button className={'!w-fit ml-[-1.714rem] border dark:border-gray-400'}>
</Button>
</div>
<Popover
className={
'max-h-[20rem] overflow-auto rounded-lg border dark:border-gray-400'
}
>
<ListBox<Option>>
{(item) => <SelectOption>{item.name}</SelectOption>}
</ListBox>
</Popover>
{({ isOpen }) => {
return (
<>
<Label>{label}</Label>
<div className="flex">
<Input className={'flex-grow'} placeholder="Select" />
<Button
className={`!w-fit ml-[-1.714rem] border dark:border-gray-400`}
>
<span
className={`transition-all inline-block ${
isOpen ? 'rotate-180' : ''
}`}
>
</span>
</Button>
</div>
<Popover
className={
'max-h-[20rem] overflow-auto rounded-lg border dark:border-gray-400'
}
>
<ListBox<Option>>
{(item) => <SelectOption>{item.name}</SelectOption>}
</ListBox>
</Popover>
</>
)
}}
</ComboBox>
)
}

0 comments on commit c4c0905

Please sign in to comment.