From 10e3313d8617c0847b67beb70c4d9670a11e9534 Mon Sep 17 00:00:00 2001 From: ndrooo Date: Fri, 9 Aug 2024 22:41:29 -0400 Subject: [PATCH] Fix theme button DOM hierarchy and styles --- quartz/components/Darkmode.tsx | 60 ++++++++++++-------------- quartz/components/styles/darkmode.scss | 9 ++-- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/quartz/components/Darkmode.tsx b/quartz/components/Darkmode.tsx index 247aa226d..6a1610c73 100644 --- a/quartz/components/Darkmode.tsx +++ b/quartz/components/Darkmode.tsx @@ -10,38 +10,34 @@ import { classNames } from "../util/lang" const Darkmode: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { return ( ) } diff --git a/quartz/components/styles/darkmode.scss b/quartz/components/styles/darkmode.scss index 30ea94466..edf4e61cf 100644 --- a/quartz/components/styles/darkmode.scss +++ b/quartz/components/styles/darkmode.scss @@ -1,14 +1,15 @@ .darkmode { + cursor: pointer; + padding: 0; position: relative; background: none; border: none; width: 20px; height: 20px; margin: 0 10px; + text-align: inherit; & svg { - cursor: pointer; - opacity: 0; position: absolute; width: 20px; height: 20px; @@ -26,7 +27,7 @@ color-scheme: light; } -:root[saved-theme="dark"] .toggle ~ label { +:root[saved-theme="dark"] .darkmode { & > #dayIcon { display: none; } @@ -35,7 +36,7 @@ } } -:root .toggle ~ label { +:root .darkmode { & > #dayIcon { display: inline; }