From 0075ab72d04b9e640c724de886a197694e6ed5ca Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 21 Sep 2021 19:51:07 +0200 Subject: chore: moved colormenu to separate component --- components/tweaks.tsx | 58 +-------------------------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) (limited to 'components') diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 2cb5b5d..686f9b8 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -58,6 +58,7 @@ import { } from './config' import FilterPanel from './FilterPanel' +import { ColorMenu } from './ColorMenu' import { ThemeContext } from '../util/themecontext' import { usePersistantState } from '../util/persistant-state' @@ -1362,60 +1363,3 @@ export const DropDownMenu = (props: DropDownMenuProps) => { ) } - -export interface ColorMenuProps { - label: string - colorList: string[] - value: string - visValue: string - setVisuals?: any -} - -export const ColorMenu = (props: ColorMenuProps) => { - const { label, colorList, value, visValue, setVisuals } = props - - const clickCallback = useCallback( - (color) => - setVisuals((curr: typeof initialVisuals) => { - return { - ...curr, - [value]: color, - } - }), - [], - ) - return ( - - {label} - - }> - {} - - - {' '} - - clickCallback('')} - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - {colorList.map((color: string) => ( - clickCallback(color)} - justifyContent="space-between" - alignItems="center" - display="flex" - > - - - ))} - - - - - ) -} -- cgit v1.2.3