feat: add dark mode
This commit is contained in:
@@ -14,6 +14,10 @@ export const metadata: Metadata = {
|
||||
description: "پنل مدیریت محتوای اپلیکیشن آرام جان",
|
||||
};
|
||||
|
||||
// Runs before paint to set the `.dark` class from saved preference / system,
|
||||
// avoiding a light flash on load. Kept inline + minimal on purpose.
|
||||
const noFlashTheme = `(function(){try{var t=localStorage.getItem('aram_theme');if(!t){t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';}if(t==='dark'){document.documentElement.classList.add('dark');}}catch(e){}})();`;
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
@@ -21,6 +25,9 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html lang="fa" dir="rtl" className={`${vazir.variable} h-full`}>
|
||||
<head>
|
||||
<script dangerouslySetInnerHTML={{ __html: noFlashTheme }} />
|
||||
</head>
|
||||
<body className="min-h-full">
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user