Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
style: active link different color, underline
Browse files Browse the repository at this point in the history
  • Loading branch information
hetd54 committed Apr 29, 2024
1 parent 0e47ba8 commit 42627c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
25 changes: 13 additions & 12 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { isHidden = true } = Astro.props

let isHidden = true
const button = this.querySelector("button")
const menuElement: HTMLElement = document.getElementById("#menu-body")!
const menuElement: HTMLElement = document.getElementById("menu-body")!
button?.addEventListener("click", () => {
isHidden = !isHidden
if (isHidden) {
Expand All @@ -35,7 +35,7 @@ const { isHidden = true } = Astro.props
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-lg py-2.5 px-4 text-black no-underline hover:text-gray-600"
class="text-base pt-2.5 px-4 text-neutral-500 hover:text-gray-600 active:text-neutral-900 "
>{data.toUpperCase()}</HeaderLink>)
}
</div>
Expand All @@ -51,15 +51,16 @@ const { isHidden = true } = Astro.props
</button>

</navbar-hamburger>
<div id="menu-body" data-hidden={isHidden} class="hidden">
<ul class="flex flex-col items-end font-medium mt-4 absolute top-16 right-6 md:right-14">
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-base pt-2.5 px-4 text-neutral-500 hover:text-gray-600 active:text-neutral-900"
>{data.toUpperCase()}</HeaderLink>)
}
</ul>
</div>
</nav>
<div id="menu-body" data-hidden={isHidden} class="hidden">
<ul class="flex flex-col items-end font-medium mt-4">
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-lg py-2.5 px-4 text-black decoration-0 hover:text-gray-600"
>{data.toUpperCase()}</HeaderLink>)
}
</ul>
</div>

</header>
4 changes: 3 additions & 1 deletion src/components/HeaderLink.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const isActive = href === pathname || href === "/" + subpath?.[0]
href={href}
class:list={[
className,
{ "text-lg py-2.5 px-4 text-black font-semibold border-b-4 hover:text-gray-600": isActive },
{
"text-neutral-900 font-semibold hover:text-gray-600 underline underline-offset-8": isActive,
},
]}
{...props}
>
Expand Down
7 changes: 0 additions & 7 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,9 @@
@apply flex;
@apply items-center;
@apply py-8;
@apply text-neutral-500;
@apply uppercase;
}

nav a:active {
@apply text-neutral-900;
@apply border-b-2;
@apply border-neutral-900;
}

main {
@apply flex;
@apply flex-col;
Expand Down

0 comments on commit 42627c4

Please sign in to comment.