-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb8a27a
commit 86d1efa
Showing
2 changed files
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,19 +84,20 @@ const Header: React.FC = () => { | |
); | ||
|
||
const [theme, setTheme] = useState<string>( | ||
() => | ||
typeof window !== "undefined" | ||
? localStorage.getItem("theme") || | ||
"https://unpkg.com/@progress/[email protected]/dist/default-main.css" | ||
: "https://unpkg.com/@progress/[email protected]/dist/default-main.css" | ||
"https://unpkg.com/@progress/[email protected]/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 <link> tag not found"); | ||
} | ||
}, [theme]); | ||
|
||
|
10 changes: 5 additions & 5 deletions
10
examples/kendo-react-e-commerce-astro-app/src/pages/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
--- | ||
|
||
<Layout> | ||
<Header client:load /> | ||
<Header client:only="react" /> | ||
<main> | ||
<Home client:load /> | ||
<Home client:only="react" /> | ||
</main> | ||
<Footer client:load /> | ||
</Layout> | ||
<Footer client:only="react" /> | ||
</Layout> |