import { forwardRef } from 'react' import { Menu } from '@headlessui/react' import Link from 'next/link' // FIXME: Update this to be used to dry up all picker components /** an accessible dropdown menu for use by picker components */ export const Picker = ({ Icon, className, title, ariaLabel, iconOnly = false, children, end }) => { return ( {!iconOnly && {title}} {children} ) } /** get the menu item's class based on whether it's active */ const itemClass = (active) => 'btn btn-ghost ' + (active ? 'bg-base-200' : '') /** * a menu item that has a link in it * * Expected Props: ** href: the href for the link ** locale?: the locale the link links to * */ export const PickerLink = (props) => { return (
  • {({ active }) => }
  • ) } /** * Necessary to have keyboard enter 'click' events passed to the link */ const ForwardLink = forwardRef(({ href, locale, active, children, ...rest }, ref) => ( {children} )) ForwardLink.displayName = 'ForwardLink' /** a menu item that is a button */ export const PickerButton = ({ onClick, children }) => { return ( {({ active }) => ( )} ) }