From 6d969f469a0859a28546824c1c7dacc07f274ab2 Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Tue, 23 Jan 2024 17:54:44 -0800 Subject: [PATCH] toggle sections --- src/content-modules/LeftPanel.svelte | 39 ++++++++++++++++++---------- src/stores/config-store.ts | 12 ++++++--- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/content-modules/LeftPanel.svelte b/src/content-modules/LeftPanel.svelte index d8ac48b9..a6c9b2c6 100644 --- a/src/content-modules/LeftPanel.svelte +++ b/src/content-modules/LeftPanel.svelte @@ -30,22 +30,33 @@
-
diff --git a/src/stores/config-store.ts b/src/stores/config-store.ts index 7eadc59d..aa94a537 100644 --- a/src/stores/config-store.ts +++ b/src/stores/config-store.ts @@ -2,7 +2,8 @@ import { writable } from "svelte/store"; interface StoreData { route: "examples" | "compare" | "eval"; - leftRoute: "controls" | "saved-pals"; + controlsOpen: boolean; + savedPalsOpen: boolean; comparePal: string | undefined; colorSim: "deuteranopia" | "protanopia" | "tritanopia" | "none"; includeQuotes: boolean; @@ -16,7 +17,8 @@ interface StoreData { const InitialStore: StoreData = { route: "examples", - leftRoute: "controls", + controlsOpen: false, + savedPalsOpen: true, comparePal: undefined, colorSim: "none", includeQuotes: false, @@ -67,8 +69,10 @@ function createStore() { persist((old) => ({ ...old, showColorBackground: n })), setTooltipXY: (xy: StoreData["tooltipXY"]) => persist((old) => ({ ...old, tooltipXY: xy })), - setLeftRoute: (route: StoreData["leftRoute"]) => - persist((old) => ({ ...old, leftRoute: route })), + setControlsOpen: (n: StoreData["controlsOpen"]) => + persist((old) => ({ ...old, controlsOpen: n })), + setSavedPalsOpen: (n: StoreData["savedPalsOpen"]) => + persist((old) => ({ ...old, savedPalsOpen: n })), }; }