diff --git a/app/components/Select.tsx b/app/components/Select.tsx new file mode 100644 index 0000000..1211ea0 --- /dev/null +++ b/app/components/Select.tsx @@ -0,0 +1,82 @@ +import { ChevronDownIcon } from '@primer/octicons-react' +import { Dispatch, ReactNode, SetStateAction } from 'react' +import { + Button, + ListBox, + ListBoxItem, + Popover, + Select as AriaSelect, + SelectValue, +} from 'react-aria-components' + +import { cn } from '~/utils/cn' + +type SelectProps = Parameters[0] & { + readonly label: string + readonly state?: [string, Dispatch>] + readonly children: ReactNode +} + +function Select(props: SelectProps) { + return ( + { + props.state?.[1](key.toString()) + }} + className={cn( + 'block w-full rounded-lg my-1', + 'border border-ui-200 dark:border-ui-600', + 'bg-white dark:bg-ui-800 dark:text-ui-300', + 'focus-within:outline-6', + props.className, + )} + > + + + + {props.children} + + + + ) +} + +type ItemProps = Parameters[0] + +function Item(props: ItemProps) { + return ( + + {props.children} + + ) +} + +export default Object.assign(Select, { Item })