update
This commit is contained in:
34
cli-center-docs/src/apps/settings/nav.tsx
Normal file
34
cli-center-docs/src/apps/settings/nav.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { wrapBasename } from "../../modules/basename";
|
||||
import { clsx } from 'clsx';
|
||||
|
||||
export const Nav = () => {
|
||||
const currentPath = typeof window !== 'undefined' ? window.location.pathname : ''
|
||||
|
||||
const navItems = [
|
||||
{ name: '管理员设置', path: wrapBasename('/settings/') },
|
||||
{ name: '全局设置', path: wrapBasename('/settings/all/') },
|
||||
];
|
||||
|
||||
const isActive = (path: string) => {
|
||||
return currentPath === path
|
||||
}
|
||||
|
||||
return (
|
||||
<nav className="space-y-2">
|
||||
{navItems.map((item) => (
|
||||
<a
|
||||
key={item.path}
|
||||
href={item.path}
|
||||
className={clsx(
|
||||
"block px-4 py-2 rounded transition-colors border-l-4",
|
||||
isActive(item.path)
|
||||
? "bg-gray-100 text-black border-black font-medium"
|
||||
: "text-gray-700 border-transparent hover:bg-gray-50 hover:border-gray-300"
|
||||
)}
|
||||
>
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user