summaryrefslogtreecommitdiff
path: root/components/Tweaks/DropDownMenu.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-09-25 16:11:31 +0200
committerThomas F. K. Jorna <[email protected]>2021-09-25 16:11:31 +0200
commitee8539a9351374a719c9026f85d85e7b4ea6e8f5 (patch)
treef9220fd304bd3669523df39ddaa0992919ccc4a6 /components/Tweaks/DropDownMenu.tsx
parent075d3831ffae63f128bcaabf9fc5e70ade41ad33 (diff)
chore: move tweaks to separate subfolder
Diffstat (limited to 'components/Tweaks/DropDownMenu.tsx')
-rw-r--r--components/Tweaks/DropDownMenu.tsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/components/Tweaks/DropDownMenu.tsx b/components/Tweaks/DropDownMenu.tsx
new file mode 100644
index 0000000..fbd854b
--- /dev/null
+++ b/components/Tweaks/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>
+ )
+}