Optimize route

This commit is contained in:
2023-11-01 09:39:22 +08:00
parent b314a9f801
commit 33b664816e
7 changed files with 41 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ type ItemProps = {
text?: string
path: string
children?: React.ReactNode
end?: boolean
}
const SidebarItem: React.FC<ItemProps> = (props) => {
@@ -34,8 +35,8 @@ const SidebarItem: React.FC<ItemProps> = (props) => {
<li className={'item'}>
<div className={'menu-bt'} onMouseEnter={showSubmenu}>
<NavLink
end={props.end}
to={props.path}
end
className={({ isActive, isPending }) =>
isPending ? 'pending' : isActive ? 'active' : ''
}