import React from 'react'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown-menu'; function classNames(...classes: string[]) { return classes.filter(Boolean).join(' '); } export interface IDropdownContextOption { label: string; value: string; disabled?: boolean; } interface IDropdownContextProps { options?: IDropdownContextOption[]; disable?: boolean; onSelect?: (value: string, index: number) => void; position?: 'center' | 'end' | 'start'; children?: React.ReactNode | Iterable; } const DropdownContext: React.FC = (props) => { const { options = [], disable, position = 'start' } = props; return ( {props.children} {options.map((option, index) => ( { props.onSelect && !props.disable && props.onSelect(option.value, index); }} > {option.label} ))} ); }; export default DropdownContext;