diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-09-21 21:00:21 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-09-21 21:00:21 +0200 |
commit | 075d3831ffae63f128bcaabf9fc5e70ade41ad33 (patch) | |
tree | 79495b8cd6f6fe2bcb67bbaf3cac6811fc70e1b1 /components/DropDownMenu.tsx | |
parent | cffebb920e7b29985fa90979dbdb56f795980f41 (diff) |
chore: separated out all tweak panels
Diffstat (limited to 'components/DropDownMenu.tsx')
-rw-r--r-- | components/DropDownMenu.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/components/DropDownMenu.tsx b/components/DropDownMenu.tsx new file mode 100644 index 0000000..fbd854b --- /dev/null +++ b/components/DropDownMenu.tsx @@ -0,0 +1,28 @@ +import { ChevronDownIcon } from '@chakra-ui/icons' +import { Button, Menu, MenuButton, MenuItem, MenuList, Portal } from '@chakra-ui/react' +import React from 'react' + +export interface DropDownMenuProps { + textArray: string[] + onClickArray: (() => void)[] + displayValue: string +} + +export const DropDownMenu = (props: DropDownMenuProps) => { + const { textArray, onClickArray, displayValue } = props + return ( + <Menu isLazy placement="right"> + <MenuButton as={Button} rightIcon={<ChevronDownIcon />}> + {displayValue} + </MenuButton> + <Portal> + {' '} + <MenuList zIndex="popover"> + {textArray.map((option, i) => { + ;<MenuItem onClick={onClickArray[i]}> {option} </MenuItem> + })} + </MenuList> + </Portal> + </Menu> + ) +} |