diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-08-16 16:43:31 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-08-16 16:44:36 +0200 |
commit | 733cf88bbfb172fe9c2211d2432e2b1ff2ffcc2d (patch) | |
tree | 7fe47d14255bf25315bb397e5bf17c9a74e35b82 /components | |
parent | d5135e1caec93b7d87b5d40f1fc911702238092a (diff) |
feat: link children to parent heading #62 #53 #49
Diffstat (limited to 'components')
-rw-r--r-- | components/config.ts | 2 | ||||
-rw-r--r-- | components/tweaks.tsx | 65 |
2 files changed, 56 insertions, 11 deletions
diff --git a/components/config.ts b/components/config.ts index b48cbe4..0c23528 100644 --- a/components/config.ts +++ b/components/config.ts @@ -34,7 +34,7 @@ export const initialPhysics = { export const initialFilter = { orphans: false, - parents: true, + parent: 'heading', filelessCites: false, tagsBlacklist: [], tagsWhitelist: [], diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 26f1b60..d0605cd 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -202,6 +202,60 @@ export const Tweaks = (props: TweakProps) => { paddingLeft={7} color="gray.800" > + <Flex alignItems="center" justifyContent="space-between"> + <Text>Link children to...</Text> + <Menu isLazy placement="right"> + <MenuButton + as={Button} + rightIcon={<ChevronDownIcon />} + colorScheme="" + color="black" + > + {(() => { + switch (filter.parent) { + case 'parent': + return <Text>File</Text> + case 'heading': + return <Text>Heading</Text> + default: + return <Text>Nothing</Text> + } + })()} + </MenuButton> + <Portal> + {' '} + <MenuList bgColor="gray.200" zIndex="popover"> + <MenuItem + onClick={() => + setFilter((curr: typeof initialFilter) => ({ ...curr, parent: '' })) + } + > + Nothing + </MenuItem> + <MenuItem + onClick={() => + setFilter((curr: typeof initialFilter) => ({ + ...curr, + parent: 'parent', + })) + } + > + Parent file node + </MenuItem> + <MenuItem + onClick={() => + setFilter((curr: typeof initialFilter) => ({ + ...curr, + parent: 'heading', + })) + } + > + Next highest heading node + </MenuItem> + </MenuList> + </Portal> + </Menu> + </Flex> <Flex justifyContent="space-between"> <Text>Orphans</Text> <Switch @@ -214,15 +268,6 @@ export const Tweaks = (props: TweakProps) => { ></Switch> </Flex> <Flex justifyContent="space-between"> - <Text>Link nodes with parent file</Text> - <Switch - onChange={() => { - setFilter({ ...filter, parents: !filter.parents }) - }} - isChecked={filter.parents} - ></Switch> - </Flex> - <Flex justifyContent="space-between"> <Text>Citations without note files</Text> <Switch onChange={() => { @@ -328,7 +373,7 @@ export const Tweaks = (props: TweakProps) => { </EnableSection> <SliderWithInfo value={-physics.charge / 100} - onChange={(v) => setPhysicsCallback(v, 'gravity', -1 / 100)} + onChange={(v) => setPhysicsCallback(v, 'charge', -1 / 100)} label="Repulsive Force" /> <EnableSection |