From ba2111621016f0b916fd2787e746afa42cfa50ab Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Thu, 23 Feb 2023 19:51:50 +0100 Subject: [PATCH] feat(astro): add theme provider for dark mode --- src/components/ThemeProvider.astro | 26 +++++++++++++++++++++ src/layouts/Layout.astro | 36 +++++++++++++++--------------- src/pages/index.astro | 4 +++- tailwind.config.cjs | 32 ++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 src/components/ThemeProvider.astro diff --git a/src/components/ThemeProvider.astro b/src/components/ThemeProvider.astro new file mode 100644 index 0000000..718bfa3 --- /dev/null +++ b/src/components/ThemeProvider.astro @@ -0,0 +1,26 @@ +--- +--- + + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 775aba3..8982ad6 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -2,6 +2,7 @@ import '../styles/global.css'; import { Sprite } from 'astro-icon'; +import ThemeProvider from '../components/ThemeProvider.astro'; export interface Props { title: string; } @@ -10,10 +11,7 @@ const { title, frontmatter } = Astro.props; --- - + @@ -33,21 +31,24 @@ const { title, frontmatter } = Astro.props; + - +