chore: minor changes

This commit is contained in:
Jewgeni Lewash 2024-03-10 13:24:45 +01:00
parent 488fea300c
commit 8ff7776bdd
3 changed files with 15 additions and 8 deletions

View File

@ -22,7 +22,6 @@ export function ModeToggle() {
theme === 'dark' || theme === 'dark' ||
(theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); (theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.classList[isDark ? 'add' : 'remove']('dark'); document.documentElement.classList[isDark ? 'add' : 'remove']('dark');
// add data-theme="dark" to the html tag
document.documentElement.setAttribute('data-theme', isDark ? 'dracula' : 'github-light'); document.documentElement.setAttribute('data-theme', isDark ? 'dracula' : 'github-light');
}, [theme]); }, [theme]);

View File

@ -4,15 +4,16 @@ import { Icon } from 'astro-icon/components';
<div class="mx-auto w-full max-w-7xl px-8"> <div class="mx-auto w-full max-w-7xl px-8">
<div <div
class="flex w-full flex-col items-center justify-center border-t border-zinc-50 py-4 dark:border-zinc-900 md:flex-row md:justify-between"> 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">
<p <p
class="mb-4 block text-center font-sans text-sm font-normal leading-normal text-zinc-900 antialiased dark:text-zinc-100 md:mb-0"> class="mb-4 text-center text-sm font-normal text-zinc-900 antialiased dark:text-zinc-100 md:mb-0">
© 2024 © 2024
<a href="/">Astro Deploy</a>. All Rights Reserved. <a href="/" class="hover:text-blue-500">Astro Deploy</a>. All Rights Reserved.
</p><div class="flex gap-4 text-zinc-900 dark:text-zinc-100 sm:justify-center"> </p>
<div class="flex gap-4 text-zinc-900 dark:text-zinc-100 sm:justify-center">
<a <a
href="https://github.com/deployn/astro-deploy" href="https://github.com/deployn/astro-deploy"
class="block font-sans text-base font-light leading-relaxed text-inherit antialiased opacity-80 transition-opacity hover:opacity-100" class="block text-base font-light leading-relaxed text-inherit antialiased opacity-80 transition-opacity hover:opacity-100"
aria-label="GitHub Repository"> aria-label="GitHub Repository">
<Icon name="line-md:github" class="size-5" fill="currentColor" aria-hidden="true" /> <Icon name="line-md:github" class="size-5" fill="currentColor" aria-hidden="true" />
</a> </a>

View File

@ -1,8 +1,15 @@
--- ---
const { pathname } = Astro.url; const { pathname } = Astro.url;
const { class: className = '', href, ...props } = Astro.props; 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);
--- ---
<a <a