From 8ff7776bdd85f1ed6f8cbe34c564c72941b96020 Mon Sep 17 00:00:00 2001 From: Jewgeni Lewash Date: Sun, 10 Mar 2024 13:24:45 +0100 Subject: [PATCH] chore: minor changes --- src/components/ModeToggle.tsx | 1 - src/components/layout/Footer.astro | 11 ++++++----- src/components/layout/HeaderLink.astro | 11 +++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/ModeToggle.tsx b/src/components/ModeToggle.tsx index abe449d..58cc282 100644 --- a/src/components/ModeToggle.tsx +++ b/src/components/ModeToggle.tsx @@ -22,7 +22,6 @@ export function ModeToggle() { theme === 'dark' || (theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); document.documentElement.classList[isDark ? 'add' : 'remove']('dark'); - // add data-theme="dark" to the html tag document.documentElement.setAttribute('data-theme', isDark ? 'dracula' : 'github-light'); }, [theme]); diff --git a/src/components/layout/Footer.astro b/src/components/layout/Footer.astro index dec416a..dbb6dbe 100644 --- a/src/components/layout/Footer.astro +++ b/src/components/layout/Footer.astro @@ -4,15 +4,16 @@ import { Icon } from 'astro-icon/components';
+ class="flex flex-col items-center justify-center border-t border-zinc-50 py-4 dark:border-zinc-900 md:flex-row md:justify-between">

+ class="mb-4 text-center text-sm font-normal text-zinc-900 antialiased dark:text-zinc-100 md:mb-0"> © 2024 - Astro Deploy. All Rights Reserved. -

+ Astro Deploy. All Rights Reserved. +

+
diff --git a/src/components/layout/HeaderLink.astro b/src/components/layout/HeaderLink.astro index 08e6490..2be5fc9 100644 --- a/src/components/layout/HeaderLink.astro +++ b/src/components/layout/HeaderLink.astro @@ -1,8 +1,15 @@ --- const { pathname } = Astro.url; const { class: className = '', href, ...props } = Astro.props; -const isActive = - href === pathname || href === (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname); + +function isActiveLink(linkPath: string, currentPath: string) { + return ( + linkPath === currentPath || + linkPath === (currentPath.endsWith('/') ? currentPath.slice(0, -1) : currentPath) + ); +} + +const isActive = isActiveLink(href, pathname); ---