From ee8539a9351374a719c9026f85d85e7b4ea6e8f5 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 25 Sep 2021 16:11:31 +0200 Subject: chore: move tweaks to separate subfolder --- components/Tweaks/index.tsx | 217 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 components/Tweaks/index.tsx (limited to 'components/Tweaks/index.tsx') diff --git a/components/Tweaks/index.tsx b/components/Tweaks/index.tsx new file mode 100644 index 0000000..c60e670 --- /dev/null +++ b/components/Tweaks/index.tsx @@ -0,0 +1,217 @@ +import { CloseIcon, RepeatClockIcon, SettingsIcon } from '@chakra-ui/icons' +import { + Accordion, + AccordionButton, + AccordionIcon, + AccordionItem, + AccordionPanel, + Box, + Button, + IconButton, + Tooltip, + Heading, +} from '@chakra-ui/react' + +import React, { useContext } from 'react' +import Scrollbars from 'react-custom-scrollbars-2' +import { + initialPhysics, + initialFilter, + initialVisuals, + initialMouse, + initialBehavior, + TagColors, + colorList, +} from '../config' + +import FilterPanel from './FilterPanel' + +import { ThemeContext } from '../../util/themecontext' +import { usePersistantState } from '../../util/persistant-state' +import { PhysicsPanel } from './PhysicsPanel' +import { VisualsPanel } from './VisualsPanel' +import { BehaviorPanel } from './BehaviorPanel' + +export interface TweakProps { + physics: typeof initialPhysics + setPhysics: any + threeDim: boolean + setThreeDim: (newValue: boolean) => void + filter: typeof initialFilter + setFilter: any + visuals: typeof initialVisuals + setVisuals: any + mouse: typeof initialMouse + setMouse: any + behavior: typeof initialBehavior + setBehavior: any + tags: string[] + tagColors: TagColors + setTagColors: any +} + +export const Tweaks = (props: TweakProps) => { + const { + physics, + setPhysics, + threeDim, + setThreeDim, + filter, + setFilter, + visuals, + setVisuals, + mouse, + setMouse, + behavior, + setBehavior, + tags, + tagColors, + setTagColors, + } = props + const [showTweaks, setShowTweaks] = usePersistantState('showTweaks', false) + const { highlightColor, setHighlightColor } = useContext(ThemeContext) + + return !showTweaks ? ( + + } + onClick={() => setShowTweaks(true)} + /> + + ) : ( + + + + + + + + } + onClick={() => { + setVisuals(initialVisuals) + setFilter(initialFilter) + setMouse(initialMouse) + setPhysics(initialPhysics) + setBehavior(initialBehavior) + }} + variant="none" + size="sm" + /> + + } + aria-label="Close Tweak Panel" + variant="ghost" + onClick={() => setShowTweaks(false)} + /> + + + ( + + )} + > + + + + + Filter + + + + + + + + + + Physics + + + + + + + + + + Visual + + + + + + + + + Behavior + + + + + + + + + ) +} -- cgit v1.2.3