From 4fd97f1bdfdf6a1722d2f71edefc958d47b7187c Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 5 Nov 2024 19:15:13 +0100 Subject: [PATCH] feat: add a theme provider --- app/layout.js | 9 +++++++-- package-lock.json | 10 ++++++++++ package.json | 1 + tailwind.config.js | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/layout.js b/app/layout.js index 0e3f556..1d68a56 100644 --- a/app/layout.js +++ b/app/layout.js @@ -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 ( - - {children} + + + + {children} + + ); } diff --git a/package-lock.json b/package-lock.json index 792da6b..fe74fa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 33e5532..ba8bd03 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "next": "^15.0.2", + "next-themes": "^0.4.3", "react": "^18.3.1", "react-dom": "^18.3.1" }, diff --git a/tailwind.config.js b/tailwind.config.js index 98c3b8d..07c89cc 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -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: {