From 20357b26e5c869af29ffa83da9a87c9e5ab45392 Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Tue, 9 Dec 2025 14:29:16 +0530 Subject: [PATCH] New CHnages with Cookies --- src/components/LanguageSwitcher.astro | 6 ++++-- src/components/ThemeSwitcher.astro | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/LanguageSwitcher.astro b/src/components/LanguageSwitcher.astro index bbfd519..90d74ef 100644 --- a/src/components/LanguageSwitcher.astro +++ b/src/components/LanguageSwitcher.astro @@ -32,6 +32,8 @@ const { ...rest }: Props = Astro.props; +const cookiesValue = Astro.cookies.get(storageKey)?.value ?? languages[0].code; + const containerId = `ls-${Math.random().toString(36).slice(2)}`; const icon = "wr:size-4"; const item = "wr:flex wr:w-full wr:items-center wr:gap-x-3.5 wr:rounded-lg wr:px-3 wr:py-2 wr:text-sm wr:hover:bg-gray-100 wr:dark:hover:bg-neutral-900 wr:focus:bg-gray-100 focus:outline-hidden dark:hover:bg-neutral-700 dark:hover:text-neutral-300 dark:focus:bg-neutral-700" @@ -89,7 +91,7 @@ const checkBase = "wr:size-4 wr:opacity-0 wr:scale-90 wr:transition"; } -