mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
Update style to display active nav link
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
---
|
||||
export interface Props {
|
||||
activeNav?: "posts" | "tags" | "about";
|
||||
}
|
||||
|
||||
const { activeNav } = Astro.props;
|
||||
---
|
||||
|
||||
<header>
|
||||
<div class="nav-container">
|
||||
<div class="top-nav-wrap">
|
||||
@@ -10,9 +18,19 @@
|
||||
</div>
|
||||
<nav class="display-none sm:flex">
|
||||
<ul>
|
||||
<li><a href="/posts">Posts</a></li>
|
||||
<li><a href="/tags">Tags</a></li>
|
||||
<li><a href="/about">About</a></li>
|
||||
<li>
|
||||
<a href="/posts" class={activeNav === "posts" ? "active" : ""}
|
||||
>Posts</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/tags" class={activeNav === "tags" ? "active" : ""}>Tags</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/about" class={activeNav === "about" ? "active" : ""}
|
||||
>About</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="button-wrapper">
|
||||
<button>
|
||||
@@ -72,6 +90,9 @@
|
||||
nav a {
|
||||
@apply py-2 px-3 font-medium hover:text-skin-accent;
|
||||
}
|
||||
nav a.active {
|
||||
@apply underline underline-offset-4 decoration-wavy decoration-2;
|
||||
}
|
||||
.button-wrapper {
|
||||
@apply flex my-2 space-x-4 sm:space-x-2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user