import IconChevronDown from '@geist-ui/icons/chevronDown'; import Link from 'next/link'; import { DetailedHTMLProps, HTMLAttributes, useId } from 'react'; import { tcls } from '@/lib/tailwind'; export type DropdownButtonProps = Omit< Partial, E>>, 'ref' >; /** * Button with a dropdown. */ export function Dropdown(props: { /** Content of the button */ button: (buttonProps: DropdownButtonProps) => React.ReactNode; /** Content of the dropdown */ children: React.ReactNode; }) { const { button, children } = props; const dropdownId = useId(); return (
{button({ id: dropdownId, tabIndex: 0, 'aria-expanded': true, 'aria-haspopup': true, })}
{children}
); } /** * Animated chevron to display in the dropdown button. */ export function DropdownChevron(props: {}) { return ( ); } /** * Group of menu items in a dropdown. */ export function DropdownMenu(props: { children: React.ReactNode }) { const { children } = props; return
{children}
; } /** * Menu item in a dropdown. */ export function DropdownMenuItem(props: { href: string; active?: boolean; children: React.ReactNode; }) { const { children, active = false, href } = props; return ( {children} ); }