File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 < link rel ="canonical " href ="https://tbusk.com/ ">
2626 <!-- favicon svg originating from https://www.svgrepo.com/svg/528183/code-square with color tweaks with author Solar Icons-->
2727 < link rel ="icon " type ="image/svg+xml " href ="/favicon.svg ">
28+ </ head >
29+ < body >
30+ < div id ="app ">
2831 < script >
2932 const t = localStorage . getItem ( 'theme' ) ?? ( matchMedia ( '(prefers-color-scheme: dark)' ) . matches ? 'dark' : 'light' ) ;
3033 document . documentElement . classList . toggle ( "dark" , t === 'dark' ) ;
3134 </ script >
32- </ head >
33- < body >
34- < div id ="app ">
35+ </ div >
3536< script type ="module " src ="/src/Entrypoint.tsx "> </ script >
3637</ body >
3738</ html >
Original file line number Diff line number Diff line change 11import { useState } from "preact/hooks" ;
22
33export function HeaderModeIcon ( ) {
4- const [ darkmode , setDarkMode ] = useState < boolean > ( localStorage . getItem ( 'theme' ) === 'dark' ) ;
4+ const [ darkmode , setDarkMode ] = useState < boolean > (
5+ localStorage . getItem ( 'theme' ) === null ? window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches : localStorage . getItem ( 'theme' ) === 'dark'
6+ ) ;
57
68 return (
79
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import myInfoJson from "../../data/my-info.json";
66export default function NavbarContentMobile ( ) {
77
88 const [ isMenuOpen , setIsMenuOpen ] = useState ( false ) ;
9- const darkmode : boolean = localStorage . getItem ( 'theme' ) === 'dark' ;
9+ const darkmode : boolean = localStorage . getItem ( 'theme' ) === null ? window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches : localStorage . getItem ( 'theme' ) === 'dark' ;
1010 const myInfo = myInfoJson ;
1111
1212 return (
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export interface MediaItem {
1313
1414export default function Media ( props : MediaProps ) {
1515
16- const darkmode : boolean = localStorage . getItem ( 'theme' ) === 'dark' ;
16+ const darkmode : boolean = localStorage . getItem ( 'theme' ) === null ? window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches : localStorage . getItem ( 'theme' ) === 'dark' ;
1717
1818 return (
1919 < div className = "pb-4" >
You can’t perform that action at this time.
0 commit comments