blog/src/components/widget/NavMenuPanel.astro

33 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-11-06 21:55:52 +08:00
---
2024-08-03 16:40:20 +08:00
import { type NavBarLink } from '../../types/config'
import { Icon } from 'astro-icon/components'
import { url } from '../../utils/url-utils'
2023-11-06 21:55:52 +08:00
interface Props {
2024-08-03 16:40:20 +08:00
links: NavBarLink[]
2023-11-06 21:55:52 +08:00
}
2024-08-03 16:40:20 +08:00
const links = Astro.props.links
2023-11-06 21:55:52 +08:00
---
<div id="nav-menu-panel" class:list={["float-panel float-panel-closed absolute transition-all fixed right-4 px-2 py-2"]}>
2023-11-06 21:55:52 +08:00
{links.map((link) => (
<a href={link.external ? link.url : url(link.url)} class="group flex justify-between items-center py-2 pl-3 pr-1 rounded-lg gap-8
2023-11-06 21:55:52 +08:00
hover:bg-[var(--btn-plain-bg-hover)] active:bg-[var(--btn-plain-bg-active)] transition
"
target={link.external ? "_blank" : null}
>
<div class="transition text-black/75 dark:text-white/75 font-bold group-hover:text-[var(--primary)] group-active:text-[var(--primary)]">
{link.name}
</div>
{!link.external && <Icon name="material-symbols:chevron-right-rounded"
2024-07-21 18:41:03 +08:00
class="transition text-[1.25rem] text-[var(--primary)]"
2023-11-06 21:55:52 +08:00
>
</Icon>}
{link.external && <Icon name="fa6-solid:arrow-up-right-from-square"
2024-07-21 18:41:03 +08:00
class="transition text-[0.75rem] text-black/25 dark:text-white/25 -translate-x-1"
2023-11-06 21:55:52 +08:00
>
</Icon>}
</a>
))}
</div>