import React from 'react'; import { Menu, MenuList, MenuItem } from '@chakra-ui/react'; interface Props { width: number; offset?: [number, number]; Button: React.ReactNode; menuList: { isActive?: boolean; child: React.ReactNode; onClick: () => any; }[]; } const MyMenu = ({ width, offset = [0, 10], Button, menuList }: Props) => { const menuItemStyles = { borderRadius: 'sm', py: 3, display: 'flex', alignItems: 'center', _hover: { backgroundColor: 'myWhite.600', color: 'hover.blue' } }; return ( {Button} {menuList.map((item, i) => ( { e.stopPropagation(); item.onClick && item.onClick(); }} color={item.isActive ? 'hover.blue' : ''} > {item.child} ))} ); }; export default MyMenu;