From 1101b2c2660fcf8cb4a917217d3813ee34414190 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Wed, 19 Jun 2024 13:07:13 -0700 Subject: [PATCH 1/5] feat: Create Blank svg as placeholder while ThemeSwitch mounts --- components/ThemeSwitch.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx index 178ec46..7f66b19 100644 --- a/components/ThemeSwitch.tsx +++ b/components/ThemeSwitch.tsx @@ -44,6 +44,7 @@ const Monitor = () => ( ) +const Blank = () => const ThemeSwitch = () => { const [mounted, setMounted] = useState(false) From 3044443bf189e4a8d0f6357c18e3a2acb87ae2f4 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Wed, 19 Jun 2024 13:09:12 -0700 Subject: [PATCH 2/5] feat: Render Blank icon if theme isn't mounted yet --- components/ThemeSwitch.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx index 7f66b19..45bde0c 100644 --- a/components/ThemeSwitch.tsx +++ b/components/ThemeSwitch.tsx @@ -57,7 +57,9 @@ const ThemeSwitch = () => {
- {resolvedTheme === 'dark' ? : } + + {mounted ? resolvedTheme === 'dark' ? : : } +
Date: Wed, 19 Jun 2024 13:11:36 -0700 Subject: [PATCH 3/5] feat: Add hover highlight classes to Nav links and svgs --- components/Header.tsx | 3 ++- components/MobileNav.tsx | 9 ++++++--- components/SearchButton.tsx | 3 ++- components/ThemeSwitch.tsx | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/Header.tsx b/components/Header.tsx index 362b7cd..3cd13aa 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -32,7 +32,8 @@ const Header = () => { {link.title} diff --git a/components/MobileNav.tsx b/components/MobileNav.tsx index b777b82..7cc2f17 100644 --- a/components/MobileNav.tsx +++ b/components/MobileNav.tsx @@ -26,7 +26,8 @@ const MobileNav = () => { xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" - className="h-8 w-8 text-gray-900 dark:text-gray-100" + className="h-8 w-8 text-gray-900 hover:text-primary-500 dark:text-gray-100 + dark:hover:text-primary-400" > { xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" - className="text-gray-900 dark:text-gray-100" + className="text-gray-900 hover:text-primary-500 dark:text-gray-100 + dark:hover:text-primary-400" > {
{link.title} diff --git a/components/SearchButton.tsx b/components/SearchButton.tsx index 3685066..9492caf 100644 --- a/components/SearchButton.tsx +++ b/components/SearchButton.tsx @@ -18,7 +18,8 @@ const SearchButton = () => { viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="h-6 w-6 text-gray-900 dark:text-gray-100" + className="h-6 w-6 text-gray-900 hover:text-primary-500 dark:text-gray-100 + dark:hover:text-primary-400" > { return (
-
+
{mounted ? resolvedTheme === 'dark' ? : : } From 44b5637398c664c5074c3a43c91638578968330f Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Wed, 19 Jun 2024 13:19:52 -0700 Subject: [PATCH 4/5] feat: Adapt svg classes to use color of parent, add group:hover --- components/ThemeSwitch.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx index 0b2408f..792c921 100644 --- a/components/ThemeSwitch.tsx +++ b/components/ThemeSwitch.tsx @@ -9,7 +9,7 @@ const Sun = () => ( xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" - className="h-6 w-6 text-gray-900 dark:text-gray-100" + className="group:hover:text-gray-100 h-6 w-6" > ( xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" - className="h-6 w-6 text-gray-900 dark:text-gray-100" + className="group:hover:text-gray-100 h-6 w-6" > @@ -37,7 +37,7 @@ const Monitor = () => ( stroke-width="2" stroke-linecap="round" stroke-linejoin="round" - className="h-6 w-6 text-gray-900 dark:text-gray-100" + className="group:hover:text-gray-100 h-6 w-6" > From ee996476d04f19711c9dc8dc8c3cfc9194ef2dc8 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Wed, 19 Jun 2024 13:20:47 -0700 Subject: [PATCH 5/5] feat: Refactor menu items with { active } to use headlessui highlighting --- components/ThemeSwitch.tsx | 54 +++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx index 792c921..9f59b0f 100644 --- a/components/ThemeSwitch.tsx +++ b/components/ThemeSwitch.tsx @@ -75,32 +75,50 @@ const ThemeSwitch = () => {
- + {({ active }) => ( + + )} - + {({ active }) => ( + + )} - + {({ active }) => ( + + )}