add dark mode

This commit is contained in:
ppc
2024-08-07 16:48:07 +01:00
parent ce405b9c90
commit ea78c45727
3 changed files with 14 additions and 5 deletions
+4 -1
View File
@@ -2,6 +2,7 @@ import type {Metadata} from "next";
import {Inter as FontSans} from "next/font/google";
import {cn} from "@/lib/utils";
import "./globals.css";
import {ThemeProvider} from "@/components/theme-provider";
const fontSans = FontSans({
subsets: ["latin"],
@@ -19,7 +20,9 @@ export default function RootLayout({children}: Readonly<{ children: React.ReactN
<title>AimeNet</title>
</head>
<body className={cn("min-h-screen bg-background font-sans antialiased", fontSans.variable)}>
{children}
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
{children}
</ThemeProvider>
</body>
</html>
);
@@ -0,0 +1,9 @@
"use client"
import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"
import { type ThemeProviderProps } from "next-themes/dist/types"
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
}
+1 -4
View File
@@ -4,10 +4,7 @@ import {fontFamily} from "tailwindcss/defaultTheme"
const config = {
darkMode: ["class"],
content: [
'./pages/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
'**/*.{ts,tsx}',
],
prefix: "",
theme: {