From 86d1efa5eff8113897ea017bd34d645e223641e2 Mon Sep 17 00:00:00 2001 From: filipKovachev Date: Thu, 5 Dec 2024 21:33:35 +0200 Subject: [PATCH] fix error --- .../src/components/Header.tsx | 15 ++++++++------- .../src/pages/index.astro | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/kendo-react-e-commerce-astro-app/src/components/Header.tsx b/examples/kendo-react-e-commerce-astro-app/src/components/Header.tsx index 36e2f567..d93e660c 100644 --- a/examples/kendo-react-e-commerce-astro-app/src/components/Header.tsx +++ b/examples/kendo-react-e-commerce-astro-app/src/components/Header.tsx @@ -84,19 +84,20 @@ const Header: React.FC = () => { ); const [theme, setTheme] = useState( - () => - typeof window !== "undefined" - ? localStorage.getItem("theme") || - "https://unpkg.com/@progress/kendo-theme-default@10.0.0/dist/default-main.css" - : "https://unpkg.com/@progress/kendo-theme-default@10.0.0/dist/default-main.css" + "https://unpkg.com/@progress/kendo-theme-default@10.0.0/dist/default-main.css" ); + useEffect(() => { + const storedTheme = localStorage.getItem("theme"); + if (storedTheme) { + setTheme(storedTheme); + } + }, []); + useEffect(() => { const themeLink = document.getElementById("theme-link") as HTMLLinkElement; if (themeLink) { themeLink.href = theme; - } else { - console.error("Theme tag not found"); } }, [theme]); diff --git a/examples/kendo-react-e-commerce-astro-app/src/pages/index.astro b/examples/kendo-react-e-commerce-astro-app/src/pages/index.astro index 595184ed..99161ec2 100644 --- a/examples/kendo-react-e-commerce-astro-app/src/pages/index.astro +++ b/examples/kendo-react-e-commerce-astro-app/src/pages/index.astro @@ -1,14 +1,14 @@ --- import Layout from '../layouts/Layout.astro'; -import Home from '../components/Home'; import Header from '../components/Header'; +import Home from '../components/Home'; import Footer from '../components/Footer'; --- -
+
- +
-