feat: add dark mode

This commit is contained in:
2026-06-03 09:01:42 +03:30
parent 7b8b8949b9
commit 4d67af0bfc
11 changed files with 155 additions and 11 deletions
+7
View File
@@ -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>