menu-bar-option.tsx 982 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import DropdownListItem from '@/features/ui/components/bootstrap-5/dropdown-list-item'
  2. import { DropdownItem } from '@/features/ui/components/bootstrap-5/dropdown-menu'
  3. import { useNestableDropdown } from '@/shared/hooks/use-nestable-dropdown'
  4. import { MouseEventHandler, ReactNode } from 'react'
  5. type MenuBarOptionProps = {
  6. title: string
  7. onClick?: MouseEventHandler
  8. disabled?: boolean
  9. trailingIcon?: ReactNode
  10. href?: string
  11. target?: string
  12. rel?: string
  13. }
  14. export const MenuBarOption = ({
  15. title,
  16. onClick,
  17. href,
  18. disabled,
  19. trailingIcon,
  20. target,
  21. rel,
  22. }: MenuBarOptionProps) => {
  23. const { setSelected } = useNestableDropdown()
  24. return (
  25. <DropdownListItem>
  26. <DropdownItem
  27. onMouseEnter={() => setSelected(null)}
  28. onClick={onClick}
  29. disabled={disabled}
  30. trailingIcon={trailingIcon}
  31. href={href}
  32. rel={rel}
  33. target={target}
  34. >
  35. {title}
  36. </DropdownItem>
  37. </DropdownListItem>
  38. )
  39. }