import { MoreOutlined } from '@ant-design/icons'; import { Button, Dropdown, Tooltip, type MenuProps } from 'antd'; import _ from 'lodash'; interface DropdownButtonsProps { items: MenuProps['items']; size?: 'small' | 'middle' | 'large'; onSelect: (val: any, item?: any) => void; } const DropdownButtons: React.FC = ({ items, size = 'small', onSelect }) => { const handleMenuClick = (item: any) => { console.log('menu click', item.key); const selectItem = _.find(items, { key: item.key }); onSelect(item.key, selectItem); }; const handleButtonClick = (e: any) => { const headItem = _.head(items); onSelect(headItem.key, headItem); }; if (!items?.length) { return null; } return ( <> {items?.length === 1 ? ( ) : ( [ , ]} > )} ); }; export default DropdownButtons;