import './index.css' import MenuItem, { MenuItemProps } from '../MenuItem' import { MenuListContext } from '../MenuList/MenuListContext' import { ReactNode, useContext } from 'react' import Icon from '../../Icon' export type DropdownMenuItemProps = Omit & { secondary?: ReactNode contentFullWidth?: boolean } /** * DropdownSelectorの選択肢として使うMenuItem */ export default function DropdownMenuItem(props: DropdownMenuItemProps) { const { value: ctxValue } = useContext(MenuListContext) const isSelected = props.value === ctxValue const { children, secondary, ...rest } = props const fullWidthClassName = props.contentFullWidth ? 'charcoal-dropdown-selector-menu-fullwidth' : '' return (
{isSelected && ( )} {children}
{secondary && ( {secondary} )}
) }