You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.5 KiB
36 lines
1.5 KiB
-
|
|
const navbarOptions = {
|
|
title: siteConfig.site_title,
|
|
showLeftMenu: true,
|
|
showRightMenu: true,
|
|
}
|
|
const _leftMenu = [
|
|
{ child: '所有文章', link: '/articles', extra: { class: (currentPath === '/articles' || currentPath === '/articles/'
|
|
? 'text-blue-600 font-bold border-b-2 border-blue-600'
|
|
: 'text-gray-700 hover:text-blue-600 hover:border-b-2 hover:border-blue-400') } },
|
|
]
|
|
const _rightMenu = !user ? [
|
|
{ child: '登录', link: '/login' },
|
|
] : [
|
|
{ child: `<span>欢迎您,</span><span class="font-semibold">${'aaa' || user.name || user.nickname}</span>`, link: '/profile' },
|
|
{ child: `<div class="fe--notice-active"></div>`, link: '/notice' },
|
|
{ child: `退出`, link: '/logout', extra: { 'hx-post': '/logout' } },
|
|
]
|
|
nav.navbar(class="relative")
|
|
.placeholder(class="h-[45px] w-full opacity-0")
|
|
.fixed-container(class="shadow fixed bg-white h-[45px] top-0 left-0 right-0 z-10")
|
|
.container.clearfix(class="h-full")
|
|
.navbar-brand
|
|
a(href="/" class="text-[20px]") #{navbarOptions.title}
|
|
if navbarOptions.showLeftMenu
|
|
.left.menu.desktop-only
|
|
- _leftMenu.forEach(item => {
|
|
a.menu-item(href=item.link)&attributes(item.extra || {})
|
|
!= item.child
|
|
- })
|
|
if navbarOptions.showRightMenu
|
|
.right.menu.desktop-only
|
|
- _rightMenu.forEach(item => {
|
|
a.menu-item(href=item.link)&attributes(item.extra || {})
|
|
!= item.child
|
|
- })
|