summaryrefslogtreecommitdiff
path: root/components/Tweaks/ThemeSelect.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-06 04:11:14 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-06 04:11:14 +0200
commit57185d21f8c85ad5063a420a12072b7d39e9e77c (patch)
tree2df3feaa904fff0e7db929742a8f241ee7d60446 /components/Tweaks/ThemeSelect.tsx
parente971a5936dbebf26a85446c8f9ed866b71514325 (diff)
feat: theme selector
Diffstat (limited to 'components/Tweaks/ThemeSelect.tsx')
-rw-r--r--components/Tweaks/ThemeSelect.tsx57
1 files changed, 57 insertions, 0 deletions
diff --git a/components/Tweaks/ThemeSelect.tsx b/components/Tweaks/ThemeSelect.tsx
new file mode 100644
index 0000000..e56d48d
--- /dev/null
+++ b/components/Tweaks/ThemeSelect.tsx
@@ -0,0 +1,57 @@
+import React, { useContext } from 'react'
+import {
+ Box,
+ Button,
+ Flex,
+ Menu,
+ MenuButton,
+ MenuItem,
+ MenuList,
+ Portal,
+ Text,
+} from '@chakra-ui/react'
+
+import { themes } from '../themes'
+import { ChevronDownIcon } from '@chakra-ui/icons'
+import { ThemeContext } from '../../util/themecontext'
+
+export const ThemeSelect = () => {
+ type Theme = { [key: string]: string }
+ const { emacsTheme, setEmacsTheme, highlightColor } = useContext(ThemeContext)
+ return (
+ <Flex alignItems="center" justifyContent="space-between" pl={7}>
+ <Text>Theme</Text>
+ <Menu isLazy placement="bottom" closeOnSelect={false}>
+ <MenuButton as={Button} colorScheme="" color="black" rightIcon={<ChevronDownIcon />}>
+ {emacsTheme[0]}
+ </MenuButton>
+ <MenuList minW={10} zIndex="popover" bgColor="gray.200">
+ <MenuItem
+ onClick={() => ''}
+ justifyContent="space-between"
+ alignItems="center"
+ display="flex"
+ >
+ <Box height={6} width={6}></Box>
+ </MenuItem>
+ {Object.keys(themes).map((theme: string, i: number) => (
+ <MenuItem
+ key={theme}
+ onClick={() => setEmacsTheme([theme, themes[theme]])}
+ justifyContent="space-between"
+ alignItems="center"
+ display="flex"
+ >
+ <Text>{theme}</Text>
+ <Flex height={6} width={20} flexDirection="column" flexWrap="wrap">
+ {Object.values(themes[theme as string]).map((color: string) => {
+ return <Box key={color} bgColor={color} flex="1 1 8px"></Box>
+ })}
+ </Flex>
+ </MenuItem>
+ ))}
+ </MenuList>
+ </Menu>
+ </Flex>
+ )
+}