import type { ReactNode } from 'react'; import { StatefulMenu } from 'baseui/menu/index.js'; import { StatefulPopover, TRIGGER_TYPE } from 'baseui/popover/index.js'; export type DropdownMenuItem = { id: string; label: string; item: T; }; type DropdownMenuProps = { items: DropdownMenuItem[]; onSelect: (item: T) => void; children: ReactNode; }; export const DropdownMenu = ({ items, onSelect, children }: DropdownMenuProps) => { return ( void }) => (
}) => { onSelect(item.item); close(); }} overrides={{ List: { style: { backgroundColor: '#111111', color: '#ffffff', borderRadius: '8px', minWidth: '220px', maxWidth: 'min(320px, calc(100vw - 24px))', paddingTop: '6px', paddingBottom: '6px', boxShadow: '0 12px 32px rgba(0, 0, 0, 0.35)', }, }, Option: { props: { getItemLabel: (menuItem: DropdownMenuItem) => menuItem.label, }, style: ({ $isHighlighted }: { $isHighlighted?: boolean }) => ({ backgroundColor: $isHighlighted ? 'rgba(255, 255, 255, 0.08)' : 'transparent', color: '#ffffff', fontSize: '13px', lineHeight: '1.4', paddingTop: '8px', paddingRight: '10px', paddingBottom: '8px', paddingLeft: '10px', }), }, }} />
)} overrides={{ Body: { style: { zIndex: 20, }, }, Inner: { style: { backgroundColor: 'transparent', }, }, }} > {children}
); };