feat: add a theme provider
This commit is contained in:
parent
9fff32d473
commit
4fd97f1bdf
4 changed files with 23 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import { Inter } from "next/font/google";
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import "./globals.css";
|
||||
|
||||
const inter = Inter({
|
||||
|
@ -38,8 +39,12 @@ export const metadata = {
|
|||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`antialiased ${inter.className}`}>{children}</body>
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<body className={`antialiased ${inter.className}`}>
|
||||
<ThemeProvider attribute="class" enableSystem={true}>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -9,6 +9,7 @@
|
|||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"next": "^15.0.2",
|
||||
"next-themes": "^0.4.3",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
|
@ -7035,6 +7036,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next-themes": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.3.tgz",
|
||||
"integrity": "sha512-nG84VPkTdUHR2YeD89YchvV4I9RbiMAql3GiLEQlPvq1ioaqPaIReK+yMRdg/zgiXws620qS1rU30TiWmmG9lA==",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/next/node_modules/postcss": {
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"next": "^15.0.2",
|
||||
"next-themes": "^0.4.3",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
|
|
|
@ -6,6 +6,11 @@ module.exports = {
|
|||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
],
|
||||
purge: {
|
||||
options: {
|
||||
safelist: ["dark"],
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
|
|
Loading…
Reference in a new issue