From 94b225ba1f55e59240d42c92d9f5f386e00084e3 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 12 Nov 2024 16:44:52 +0300 Subject: [PATCH] Add base tab --- .../components/layout/AppDesigner.vue | 41 +++++++------ .../layout/designer/DesignTokenField.vue | 60 ++++++++++++++++++- .../designer/primitive/DesignBorderRadius.vue | 18 ++---- .../designer/semantic/DesignGeneral.vue | 27 +++------ 4 files changed, 97 insertions(+), 49 deletions(-) diff --git a/apps/showcase/components/layout/AppDesigner.vue b/apps/showcase/components/layout/AppDesigner.vue index 45ce74629..72c43192d 100644 --- a/apps/showcase/components/layout/AppDesigner.vue +++ b/apps/showcase/components/layout/AppDesigner.vue @@ -13,17 +13,23 @@
Built-in Themes + Four alternatives to choose from.
OR -
- Import Figma Tokens - +
+ Load Theme + Continue editing the theme files stored locally. +
OR -
- Saved Theme -
@@ -120,18 +126,9 @@ export default { }; }, mounted() { - const savedTheme = localStorage.getItem(this.$appState.designerKey); - - if (savedTheme) { - this.preset = JSON.parse(savedTheme).defaultTheme; - setTimeout(() => { - usePreset(this.preset); - }, 2000); - } else { - this.preset.semantic.primary = this.preset.primitive.emerald; - this.preset.semantic.colorScheme.light.surface = { ...{ 0: '#ffffff' }, ...this.preset.primitive.slate }; - this.preset.semantic.colorScheme.dark.surface = { ...{ 0: '#ffffff' }, ...this.preset.primitive.zinc }; - } + this.preset.semantic.primary = this.preset.primitive.emerald; + this.preset.semantic.colorScheme.light.surface = { ...{ 0: '#ffffff' }, ...this.preset.primitive.slate }; + this.preset.semantic.colorScheme.dark.surface = { ...{ 0: '#ffffff' }, ...this.preset.primitive.zinc }; }, methods: { apply() { @@ -194,6 +191,14 @@ app.mount("#app"); }; localStorage.setItem(this.$appState.designerKey, JSON.stringify(themeRecord)); + }, + loadFromLocalStorage() { + const savedTheme = localStorage.getItem(this.$appState.designerKey); + + if (savedTheme) { + this.preset = JSON.parse(savedTheme).defaultTheme; + this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Theme loaded to Designer', life: 3000 }); + } } } }; diff --git a/apps/showcase/components/layout/designer/DesignTokenField.vue b/apps/showcase/components/layout/designer/DesignTokenField.vue index 40315a1fa..c62cfc00e 100644 --- a/apps/showcase/components/layout/designer/DesignTokenField.vue +++ b/apps/showcase/components/layout/designer/DesignTokenField.vue @@ -1,7 +1,22 @@ @@ -9,6 +24,32 @@