From 536a2adce1ef860ddce1707224c8b10aaf509f60 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 21 Sep 2021 19:56:17 +0200 Subject: chore: separated out more components --- components/tweaks.tsx | 80 ++------------------------------------------------- 1 file changed, 3 insertions(+), 77 deletions(-) diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 686f9b8..b19ff75 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -62,6 +62,9 @@ import { ColorMenu } from './ColorMenu' import { ThemeContext } from '../util/themecontext' import { usePersistantState } from '../util/persistant-state' +import { SliderWithInfo } from './SliderWithInfo' +import { EnableSection } from './EnableSection' +import { InfoTooltip } from './InfoTooltip' export interface TweakProps { physics: typeof initialPhysics @@ -1262,83 +1265,6 @@ export const Tweaks = (props: TweakProps) => { ) } -export interface InfoTooltipProps { - infoText?: string | boolean -} -export const InfoTooltip = (props: InfoTooltipProps) => { - const { infoText } = props - return ( - - - - - - ) -} -export interface SliderWithInfoProps { - min?: number - max?: number - step?: number - value: number - onChange: (arg0: number) => void - label: string - infoText?: string -} -export const SliderWithInfo = ({ - min = 0, - max = 10, - step = 0.1, - value = 1, - ...rest -}: SliderWithInfoProps) => { - const { onChange, label, infoText } = rest - const { highlightColor } = useContext(ThemeContext) - return ( - - - {label} - {infoText && } - - - - - - - - - - - ) -} - -export interface EnableSectionProps { - label: string - value: boolean | number - onChange: () => void - infoText?: string - children: React.ReactNode -} - -export const EnableSection = (props: EnableSectionProps) => { - const { value, onChange, label, infoText, children } = props - return ( - - - - {label} - {infoText && } - - - - - - {children} - - - - ) -} - export interface DropDownMenuProps { textArray: string[] onClickArray: (() => void)[] -- cgit v1.2.3