Skip to content

Commit d816726

Browse files
feat: add dark mode with dark as default theme
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
1 parent 5b4cea4 commit d816726

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/app/layout.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Metadata } from 'next';
22
import { Geist, Geist_Mono } from 'next/font/google';
33
import { TooltipProvider } from '@/components/ui/tooltip';
4+
import { ThemeProvider } from '@/components/theme-provider';
45
import './globals.css';
56

67
const geistSans = Geist({
@@ -14,8 +15,8 @@ const geistMono = Geist_Mono({
1415
});
1516

1617
export const metadata: Metadata = {
17-
title: 'Create Next App',
18-
description: 'Generated by create next app',
18+
title: 'Wareflow',
19+
description: 'A centralized platform for logistics management',
1920
};
2021

2122
export default function RootLayout({
@@ -24,9 +25,16 @@ export default function RootLayout({
2425
children: React.ReactNode;
2526
}>) {
2627
return (
27-
<html lang="en" className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
28-
<body className="min-h-full flex flex-col">
29-
<TooltipProvider>{children}</TooltipProvider>
28+
<html lang="en" suppressHydrationWarning className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
29+
<body className="min-h-full flex flex-col bg-background text-foreground">
30+
<ThemeProvider
31+
attribute="class"
32+
defaultTheme="dark"
33+
enableSystem={false}
34+
disableTransitionOnChange
35+
>
36+
<TooltipProvider>{children}</TooltipProvider>
37+
</ThemeProvider>
3038
</body>
3139
</html>
3240
);

src/components/theme-provider.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use client";
2+
3+
import * as React from "react";
4+
import { ThemeProvider as NextThemesProvider } from "next-themes";
5+
6+
export function ThemeProvider({
7+
children,
8+
...props
9+
}: React.ComponentProps<typeof NextThemesProvider>) {
10+
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
11+
}

0 commit comments

Comments
 (0)