diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-10-11 01:46:29 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-10-11 01:46:29 +0200 |
commit | ca8adb497460e39654069ef583d851dd05078cb4 (patch) | |
tree | ef194bebfe1154823450daa708396782109dfe82 /components/Tweaks | |
parent | bb6fe7325dfe76c0618d34455e56122c3204a3b3 (diff) | |
parent | f495a9499c549d92d64ee3a2e50a239ea769c609 (diff) |
chore(preview): merge branches
Diffstat (limited to 'components/Tweaks')
-rw-r--r-- | components/Tweaks/FilterPanel.tsx | 23 | ||||
-rw-r--r-- | components/Tweaks/ThemeSelect.tsx | 57 | ||||
-rw-r--r-- | components/Tweaks/VisualsPanel.tsx | 13 |
3 files changed, 90 insertions, 3 deletions
diff --git a/components/Tweaks/FilterPanel.tsx b/components/Tweaks/FilterPanel.tsx index df1dd81..39233f9 100644 --- a/components/Tweaks/FilterPanel.tsx +++ b/components/Tweaks/FilterPanel.tsx @@ -46,9 +46,15 @@ const FilterPanel = (props: FilterPanelProps) => { color="gray.800" > <Flex alignItems="center" justifyContent="space-between"> - <Text>Link children to...</Text> + <Text>Link children to</Text> <Menu isLazy placement="right"> - <MenuButton as={Button} rightIcon={<ChevronDownIcon />} colorScheme="" color="black"> + <MenuButton + as={Button} + rightIcon={<ChevronDownIcon />} + colorScheme="" + color="black" + size="sm" + > {(() => { switch (filter.parent) { case 'parent': @@ -106,6 +112,17 @@ const FilterPanel = (props: FilterPanelProps) => { ></Switch> </Flex> <Flex justifyContent="space-between"> + <Text>Dailies</Text> + <Switch + onChange={() => { + setFilter((curr: typeof initialFilter) => { + return { ...curr, dailies: !curr.dailies } + }) + }} + isChecked={filter.dailies} + ></Switch> + </Flex> + <Flex justifyContent="space-between"> <Text>Citations without note files</Text> <Switch onChange={() => { @@ -150,7 +167,7 @@ const FilterPanel = (props: FilterPanelProps) => { </AccordionItem> <AccordionItem> <AccordionButton> - Tag Colors + Tag colors <AccordionIcon /> </AccordionButton> <AccordionPanel pr={0} mr={0}> diff --git a/components/Tweaks/ThemeSelect.tsx b/components/Tweaks/ThemeSelect.tsx new file mode 100644 index 0000000..6a6b5d8 --- /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} pr={2}> + <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> + ) +} 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 ( <VStack justifyContent="flex-start" align="stretch"> + <ThemeSelect /> <Accordion allowToggle defaultIndex={[0]} paddingLeft={3}> <AccordionItem> <AccordionButton> @@ -98,3 +108,6 @@ export const VisualsPanel = (props: VisualsPanelProps) => { </VStack> ) } +function clickCallback(color: string): void { + throw new Error('Function not implemented.') +} |