refactor: remove theme switching, keep dark mode permanent
This commit is contained in:
1 parent
a6fcf0eb7b
commit
0d84231ec1
2 files changed
+17
-101
No files matched your search
+1
-23
@@ -48,30 +48,8 @@ export default function RootLayout({
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning={true}>
|
||||
<html lang="en" className="dark" suppressHydrationWarning={true}>
|
||||
<head>
|
||||
<script dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function() {
|
||||
const theme = localStorage.getItem('theme-mode') || 'dark';
|
||||
const html = document.documentElement;
|
||||
|
||||
if (theme === 'dark') {
|
||||
html.classList.add('dark');
|
||||
} else if (theme === 'light') {
|
||||
html.classList.remove('dark');
|
||||
} else if (theme === 'system') {
|
||||
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
if (isDark) {
|
||||
html.classList.add('dark');
|
||||
} else {
|
||||
html.classList.remove('dark');
|
||||
}
|
||||
}
|
||||
})();
|
||||
`
|
||||
}} />
|
||||
</head>
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user