Beautiful theme switch
This commit is contained in:
@@ -10,15 +10,6 @@ interface ILayoutProps {
|
||||
}
|
||||
|
||||
const Layout: NextPage<ILayoutProps> = ({ title, children }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
const theme = window.localStorage.getItem("theme");
|
||||
if(!theme || !document) return;
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return <>
|
||||
<Head>
|
||||
<title>{title ?? "c0ntroller.de"}</title>
|
||||
|
||||
Reference in New Issue
Block a user