From d19f9a8acbdab4e8465c995efc1d6a5e3a81ea02 Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Thu, 19 Sep 2024 09:31:43 -0600 Subject: [PATCH] close modal on click --- .../src/content-modules/Manage.svelte | 274 +++++++++--------- .../src/controls/FolderConfig.svelte | 3 +- 2 files changed, 144 insertions(+), 133 deletions(-) diff --git a/apps/color-buddy/src/content-modules/Manage.svelte b/apps/color-buddy/src/content-modules/Manage.svelte index e14e443..20aae9c 100644 --- a/apps/color-buddy/src/content-modules/Manage.svelte +++ b/apps/color-buddy/src/content-modules/Manage.svelte @@ -164,142 +164,152 @@ Palettes... - { - modalState = "closed"; - onClose(); - }} -> -
Palettes
-
-
-
My Folders
-
- {#each folders as folder} -
- - {#if folder !== ""} -
- -
- {/if} -
- {/each} - + {#if folder !== ""} +
+ +
+ {/if} +
+ {/each} + -
-
-
-
Samples
-
- {#each ["sequential", "categorical", "diverging"] as folder} -
- +
+
+
+
Samples
+
+ {#each ["sequential", "categorical", "diverging"] as folder} +
- {folder} - -
- {/each} + +
+ {/each} +
+
+ +
+ Thumbnail Style: +
- -
- Thumbnail Style: - -
- -
- {#if selectedFolder.isPreMade} - {#each familiarPals as palette} - {#if palette.type === selectedFolder.name} - usePal(palette)} - title={palette.name} - operations={[ - { - name: "Use the palette", - action: () => usePal(palette), - closeOnClick: true, - }, - ]} - /> - {/if} - {/each} - {:else} - {#each $colorStore.palettes as pal, paletteIdx} - {#if pal.folder.toLowerCase() === selectedFolder?.name.toLowerCase()} - { - const newPals = [...$colorStore.palettes]; - newPals[paletteIdx] = { ...pal, name }; - colorStore.setPalettes(newPals); - }} - allowInteraction={false} - allowResize={false} - palette={pal} - titleClick={() => { - colorStore.startUsingPal(paletteIdx); - }} - title={pal.name} - previewIndex={$configStore.manageBrowsePreviewIdx} - operations={makeOperations(paletteIdx, pal)} - /> - {/if} - {/each} - {/if} -
-
+
+ {#if selectedFolder.isPreMade} + {#each familiarPals as palette} + {#if palette.type === selectedFolder.name} + { + usePal(palette); + onClose(); + }} + title={palette.name} + operations={[ + { + name: "Use the palette", + action: () => usePal(palette), + closeOnClick: true, + }, + ]} + /> + {/if} + {/each} + {:else} + {#each $colorStore.palettes as pal, paletteIdx} + {#if pal.folder.toLowerCase() === selectedFolder?.name.toLowerCase()} + { + const newPals = [...$colorStore.palettes]; + newPals[paletteIdx] = { ...pal, name }; + colorStore.setPalettes(newPals); + }} + allowInteraction={false} + allowResize={false} + palette={pal} + titleClick={() => { + colorStore.startUsingPal(paletteIdx); + if (pal.folder === selectedFolder?.name) { + onClose(); + } + }} + title={pal.name} + previewIndex={$configStore.manageBrowsePreviewIdx} + operations={makeOperations(paletteIdx, pal)} + /> + {/if} + {/each} + {/if} +
+ +{/if} diff --git a/apps/color-buddy/src/controls/FolderConfig.svelte b/apps/color-buddy/src/controls/FolderConfig.svelte index e3955ae..dd26c3a 100644 --- a/apps/color-buddy/src/controls/FolderConfig.svelte +++ b/apps/color-buddy/src/controls/FolderConfig.svelte @@ -3,7 +3,7 @@ import configStore from "../stores/config-store"; import Tooltip from "../components/Tooltip.svelte"; import DownChev from "virtual:icons/fa6-solid/angle-down"; - import { simpleTooltipRowStyle } from "../lib/styles"; + import { simpleTooltipRowStyle, buttonStyle } from "../lib/styles"; export let folder: string; let renaming = false; function doRename(newFolder: string) { @@ -51,6 +51,7 @@ {#if renaming} { if (e.key === "Enter") {