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>
|
<header>
|
||||||
<div class="nav-container">
|
<div class="nav-container">
|
||||||
<div class="top-nav-wrap">
|
<div class="top-nav-wrap">
|
||||||
@@ -10,9 +18,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<nav class="display-none sm:flex">
|
<nav class="display-none sm:flex">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/posts">Posts</a></li>
|
<li>
|
||||||
<li><a href="/tags">Tags</a></li>
|
<a href="/posts" class={activeNav === "posts" ? "active" : ""}
|
||||||
<li><a href="/about">About</a></li>
|
>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>
|
</ul>
|
||||||
<div class="button-wrapper">
|
<div class="button-wrapper">
|
||||||
<button>
|
<button>
|
||||||
@@ -72,6 +90,9 @@
|
|||||||
nav a {
|
nav a {
|
||||||
@apply py-2 px-3 font-medium hover:text-skin-accent;
|
@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 {
|
.button-wrapper {
|
||||||
@apply flex my-2 space-x-4 sm:space-x-2;
|
@apply flex my-2 space-x-4 sm:space-x-2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user