From 17a1981fba59ed2a008ec76052982207df1f150d Mon Sep 17 00:00:00 2001 From: z0x Date: Fri, 23 May 2025 21:04:11 -0400 Subject: [PATCH] feat: update theme handling and improve icons --- astro.config.ts | 2 +- src/components/Breadcrumbs.astro | 14 ++++++---- src/components/Head.astro | 1 + src/components/ThemeToggle.astro | 47 ++++++++++++++++++-------------- src/layouts/Layout.astro | 2 +- src/pages/blog/[...id].astro | 4 +-- src/pages/blog/[...page].astro | 4 +-- src/styles/global.css | 20 ++------------ 8 files changed, 45 insertions(+), 49 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index bb97437..9d9b24e 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ themes: ["github-light", "github-dark"], plugins: [pluginCollapsibleSections(), pluginLineNumbers()], useDarkModeMediaQuery: false, - themeCssSelector: (theme) => `.${theme.name.split("-")[1]}`, + themeCssSelector: (theme) => `[data-theme="${theme.name.split("-")[1]}"]`, defaultProps: { wrap: true, collapseStyle: "collapsible-auto", diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro index 4eb6c2b..70d0362 100644 --- a/src/components/Breadcrumbs.astro +++ b/src/components/Breadcrumbs.astro @@ -27,7 +27,7 @@ const { items, class: className } = Astro.props; - + { @@ -38,15 +38,19 @@ const { items, class: className } = Astro.props; {index === items.length - 1 ? ( - {item.icon && } - {item.label} + {item.icon && ( + + )} + {item.label} ) : ( - {item.icon && } - {item.label} + {item.icon && ( + + )} + {item.label} )} diff --git a/src/components/Head.astro b/src/components/Head.astro index eea2258..55accca 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -18,6 +18,7 @@ const { title, description } = Astro.props; + diff --git a/src/components/ThemeToggle.astro b/src/components/ThemeToggle.astro index 2c83dd6..f99edd8 100644 --- a/src/components/ThemeToggle.astro +++ b/src/components/ThemeToggle.astro @@ -3,7 +3,13 @@ import { Button } from "@/components/ui/button"; import { Icon } from "astro-icon/components"; --- -