From ab3ec40a1ea8a21eb7a0468f841ad617e0b0155b Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Mon, 2 Aug 2021 14:01:56 +0200 Subject: feature: citation options --- components/config.ts | 5 + components/tweaks.tsx | 533 ++++++++++++++------------------------------------ 2 files changed, 150 insertions(+), 388 deletions(-) (limited to 'components') diff --git a/components/config.ts b/components/config.ts index ac4f9c8..1181f65 100644 --- a/components/config.ts +++ b/components/config.ts @@ -81,6 +81,11 @@ export const initialVisuals = { labelTextColor: 'black', labelBackgroundColor: 'white', labelBackgroundOpacity: 0.7, + citeDashes: true, + citeDashLength: 35, + citeGapLength: 15, + citeLinkColor: 'gray.600', + citeNodeColor: 'black', } export const initialBehavior = { diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 0568c7d..3c9ee00 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -96,10 +96,6 @@ export const Tweaks = (props: TweakProps) => { 'gray.500', 'gray.600', 'white', - 'black', - ] - const grays = [ - 'black', 'gray.100', 'gray.200', 'gray.300', @@ -109,7 +105,7 @@ export const Tweaks = (props: TweakProps) => { 'gray.700', 'gray.800', 'gray.900', - 'white', + 'black', ] return ( <> @@ -540,7 +536,7 @@ export const Tweaks = (props: TweakProps) => { ))} - {grays.map((color) => ( + {colorList.map((color) => ( @@ -606,211 +602,38 @@ export const Tweaks = (props: TweakProps) => { - - Link Highlight - - } - > - { - - } - - - {' '} - - - setVisuals({ ...visuals, linkHighlight: '' }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - {colorList.map((color) => ( - - setVisuals({ ...visuals, linkHighlight: color }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - - - Node Highlight - - } - > - { - - } - - - {' '} - - - setVisuals({ ...visuals, nodeHighlight: '' }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - {colorList.map((color) => ( - - setVisuals({ ...visuals, nodeHighlight: color }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - - - Background - - } - > - { - - } - - - {' '} - - {grays.map((color) => ( - - setVisuals({ ...visuals, backgroundColor: color }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - - - Emacs Node - - } - > - { - - } - - - {' '} - - - setVisuals({ ...visuals, emacsNodeColor: '' }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - {colorList.map((color) => ( - - setVisuals({ ...visuals, emacsNodeColor: color }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - + + + + @@ -862,6 +685,41 @@ export const Tweaks = (props: TweakProps) => { onChange={(value) => setVisuals({ ...visuals, linkOpacity: value })} /> )} + setVisuals({ ...visuals, citeDashes: !visuals.citeDashes })} + > + + setVisuals({ ...visuals, citeDashLength: value * 10 }) + } + /> + setVisuals({ ...visuals, citeGapLength: value * 5 })} + /> + + + Labels @@ -906,108 +764,22 @@ export const Tweaks = (props: TweakProps) => { paddingLeft={2} color="gray.800" > - - Text - - } - color="black" - colorScheme="" - > - { - - } - - - {' '} - - {grays.map((color) => ( - - setVisuals({ - ...visuals, - labelTextColor: color, - }) - } - > - - - ))} - - - - - - Background - - } - color="black" - colorScheme="" - > - { - - } - - - {' '} - - - setVisuals({ - ...visuals, - labelBackgroundColor: '', - }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - None - - {grays.map((color) => ( - - setVisuals({ - ...visuals, - labelBackgroundColor: color, - }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - + + { step={0.01} onChange={(value) => setVisuals({ ...visuals, arrowsPos: value })} /> - - Arrow Color - - } - > - { - - } - - - {' '} - - setVisuals({ ...visuals, arrowsColor: '' })} - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - {colorList.map((color) => ( - - setVisuals({ - ...visuals, - arrowsColor: color, - }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - {grays.map((color) => ( - - setVisuals({ - ...visuals, - arrowsColor: color, - }) - } - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - + { ) } + +export interface ColorMenuProps { + label: string + colorList: string[] + value: string + visuals: typeof initialVisuals + visValue: string + setVisuals?: any +} + +export const ColorMenu = (props: ColorMenuProps) => { + const { label, colorList, value, visuals, visValue, setVisuals } = props + return ( + + {label} + + }> + {} + + + {' '} + + setVisuals({ ...visuals, [value]: '' })} + justifyContent="space-between" + alignItems="center" + display="flex" + > + + + {colorList.map((color: string) => ( + + setVisuals({ + ...visuals, + [value]: color, + }) + } + justifyContent="space-between" + alignItems="center" + display="flex" + > + + + ))} + + + + + ) +} -- cgit v1.2.3