File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
examples/kendo-react-e-commerce-astro-app/src Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -84,19 +84,20 @@ const Header: React.FC = () => {
8484 ) ;
8585
8686 const [ theme , setTheme ] = useState < string > (
87- ( ) =>
88- typeof window !== "undefined"
89- ? localStorage . getItem ( "theme" ) ||
90- "https://unpkg.com/@progress/[email protected] /dist/default-main.css" 91- :
"https://unpkg.com/@progress/[email protected] /dist/default-main.css" 87+ "https://unpkg.com/@progress/[email protected] /dist/default-main.css" 9288 ) ;
9389
90+ useEffect ( ( ) => {
91+ const storedTheme = localStorage . getItem ( "theme" ) ;
92+ if ( storedTheme ) {
93+ setTheme ( storedTheme ) ;
94+ }
95+ } , [ ] ) ;
96+
9497 useEffect ( ( ) => {
9598 const themeLink = document . getElementById ( "theme-link" ) as HTMLLinkElement ;
9699 if ( themeLink ) {
97100 themeLink . href = theme ;
98- } else {
99- console . error ( "Theme <link> tag not found" ) ;
100101 }
101102 } , [ theme ] ) ;
102103
Original file line number Diff line number Diff line change 11---
22import Layout from ' ../layouts/Layout.astro' ;
3- import Home from ' ../components/Home' ;
43import Header from ' ../components/Header' ;
4+ import Home from ' ../components/Home' ;
55import Footer from ' ../components/Footer' ;
66---
77
88<Layout >
9- <Header client:load />
9+ <Header client:only = " react " />
1010 <main >
11- <Home client:load />
11+ <Home client:only = " react " />
1212 </main >
13- <Footer client:load />
14- </Layout >
13+ <Footer client:only = " react " />
14+ </Layout >
You can’t perform that action at this time.
0 commit comments