diff options
author | Kirill Rogovoy <[email protected]> | 2021-07-22 20:53:38 +0300 |
---|---|---|
committer | Kirill Rogovoy <[email protected]> | 2021-07-22 20:53:38 +0300 |
commit | 90e6ea18850ee01af21b65a9cff4537d9018c606 (patch) | |
tree | bfe5a60b507545c5dd4ac32a341387e1009610a5 | |
parent | e558154272df5c35ac443c32d8a300d5814c4717 (diff) |
Make Tweaks closable
-rw-r--r-- | pages/index.tsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index e0619ba..04f1fc7 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -178,6 +178,7 @@ export function GraphPage() { }, []) const [threeDim, setThreeDim] = useState(false) + const [showTweeks, setShowTweeks] = useState(true) if (!graphData) { return null @@ -185,13 +186,16 @@ export function GraphPage() { return ( <div> - <Tweaks + {showTweeks && <Tweaks {...{ physics, setPhysics, threeDim, }} - /> + onClose={() => { + setShowTweeks(false) + }} + />} <Graph nodeById={nodeByIdRef.current!} linksByNodeId={linksByNodeIdRef.current!} @@ -282,9 +286,10 @@ export interface TweakProps { physics: typeof initialPhysics setPhysics: any threeDim: boolean + onClose: () => void } export const Tweaks = function (props: TweakProps) { - const { physics, setPhysics, threeDim } = props + const { physics, setPhysics, threeDim, onClose } = props return ( <Box zIndex="overlay" @@ -305,7 +310,7 @@ export const Tweaks = function (props: TweakProps) { onClick={() => setPhysics(initialPhysics)} /> </Tooltip> - <CloseButton /> + <CloseButton onClick={onClose} /> </Box> <Accordion allowMultiple defaultIndex={[0]} allowToggle> <AccordionItem> |