Procházet zdrojové kódy

Fix dark mode flash of white on page reload (#10)

* restructure sidebar

* fix flickering in darkmdoe
Bernt Christian Egeland před 7 měsíci
rodič
revize
06127f0be2
1 změnil soubory, kde provedl 7 přidání a 0 odebrání
  1. 7 0
      src/app/layout.tsx

+ 7 - 0
src/app/layout.tsx

@@ -69,6 +69,13 @@ export default function RootLayout({
 }>) {
   return (
     <html lang="en" suppressHydrationWarning>
+      <head>
+        <script
+          dangerouslySetInnerHTML={{
+            __html: `(function(){try{var t=localStorage.getItem('torqvoice-theme')||'dark';if(t==='system'){t=matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light'}document.documentElement.classList.add(t)}catch(e){}})()`,
+          }}
+        />
+      </head>
       <body className={`${geistSans.variable} ${geistMono.variable} font-sans antialiased`}>
         <ThemeProvider defaultTheme="dark">
           <QueryProvider>