From f94a8cf320d1ecca697559c6f3ee6a47cd878bb0 Mon Sep 17 00:00:00 2001 From: 37b7 Date: Mon, 19 May 2025 16:37:08 +0200 Subject: [PATCH] 01964 --- assets/css/theme.css | 19 +++++++++++++++++++ components/ThemeToggle.vue | 25 ++++++------------------- nuxt.config.ts | 15 +++++++++++---- pages/projects/[id]/index.vue | 21 +++++++++------------ plugins/router.ts | 35 ++++++++++++++++++++--------------- plugins/theme.ts | 28 ++++++++++++++++------------ 6 files changed, 81 insertions(+), 62 deletions(-) diff --git a/assets/css/theme.css b/assets/css/theme.css index 6363a9d..b677c90 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -1,5 +1,14 @@ :root { --transition-speed: 0.3s; + + /* based thème */ + --bg-primary: var(--bg-primary-default); + --bg-secondary: var(--bg-secondary-default); + --bg-hover: var(--bg-hover-default); + --text-primary: var(--text-primary-default); + --text-secondary: var(--text-secondary-default); + --border-color: var(--border-color-default); + --shadow-color: var(--shadow-color-default); } [data-theme="dark"] { @@ -20,4 +29,14 @@ --text-secondary: #666666; --border-color: #dee2e6; --shadow-color: rgba(0, 0, 0, 0.1); +} + +[data-theme="default"] { + --bg-primary-default: #ffffff; + --bg-secondary-default: #f8f9fa; + --bg-hover-default: #e9ecef; + --text-primary-default: #333333; + --text-secondary-default: #666666; + --border-color-default: #dee2e6; + --shadow-color-default: rgba(0, 0, 0, 0.1); } \ No newline at end of file diff --git a/components/ThemeToggle.vue b/components/ThemeToggle.vue index 7353b49..b53d6e0 100644 --- a/components/ThemeToggle.vue +++ b/components/ThemeToggle.vue @@ -8,26 +8,13 @@ import { TEXTS } from '../config/content'; import { computed } from 'vue'; -const props = defineProps({ - 'isDark': { - type: [Boolean, Object], - default: false - }, - 'toggleTheme': { - type: Function, - required: true - } -}); +const { $theme } = useNuxtApp(); -// Gérer le cas où isDark est un Ref ou un booléen direct -const themeIsDark = computed(() => { - if (typeof props.isDark === 'boolean') { - return props.isDark; - } else if (props.isDark && typeof props.isDark.value === 'boolean') { - return props.isDark.value; - } - return false; -}); +const themeIsDark = computed(() => $theme.isDark); + +const toggleTheme = () => { + $theme.toggleTheme(); +};