From 57185d21f8c85ad5063a420a12072b7d39e9e77c Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Wed, 6 Oct 2021 04:11:14 +0200 Subject: feat: theme selector --- components/Tweaks/ThemeSelect.tsx | 57 ++++++++++++++++++++++++++++++++++++++ components/Tweaks/VisualsPanel.tsx | 13 +++++++++ 2 files changed, 70 insertions(+) create mode 100644 components/Tweaks/ThemeSelect.tsx (limited to 'components/Tweaks') 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 ( + + Theme + + }> + {emacsTheme[0]} + + + ''} + justifyContent="space-between" + alignItems="center" + display="flex" + > + + + {Object.keys(themes).map((theme: string, i: number) => ( + setEmacsTheme([theme, themes[theme]])} + justifyContent="space-between" + alignItems="center" + display="flex" + > + {theme} + + {Object.values(themes[theme as string]).map((color: string) => { + return + })} + + + ))} + + + + ) +} diff --git a/components/Tweaks/VisualsPanel.tsx b/components/Tweaks/VisualsPanel.tsx index 559975d..d3c8415 100644 --- a/components/Tweaks/VisualsPanel.tsx +++ b/components/Tweaks/VisualsPanel.tsx @@ -7,6 +7,13 @@ import { VStack, AccordionIcon, AccordionPanel, + MenuButton, + Menu, + Button, + Box, + Portal, + MenuList, + MenuItem, } from '@chakra-ui/react' import React, { useCallback } from 'react' import { HighlightingPanel } from './HighlightingPanel' @@ -15,6 +22,8 @@ import { initialVisuals } from '../config' import { NodesNLinksPanel } from './NodesNLinksPanel' import { LabelsPanel } from './LabelsPanel' import { CitationsPanel } from './CitationsPanel' +import { ColorMenu } from './ColorMenu' +import { ThemeSelect } from './ThemeSelect' export interface VisualsPanelProps { visuals: typeof initialVisuals @@ -29,6 +38,7 @@ export const VisualsPanel = (props: VisualsPanelProps) => { const setVisualsCallback = useCallback((val) => setVisuals(val), []) return ( + @@ -98,3 +108,6 @@ export const VisualsPanel = (props: VisualsPanelProps) => { ) } +function clickCallback(color: string): void { + throw new Error('Function not implemented.') +} -- cgit v1.2.3