feat(ui): refine default frontend layouts

This commit is contained in:
CaIon
2026-04-29 11:40:05 +08:00
parent 438410708f
commit f982544825
28 changed files with 926 additions and 587 deletions
+6 -2
View File
@@ -40,11 +40,16 @@ export function checkIsActive(
item: NavItem,
mainNav = false
): boolean {
const hrefWithoutQuery = href.split('?')[0]
if (item.activeUrls?.some((url) => urlToString(url) === hrefWithoutQuery)) {
return true
}
// For collapsible items (NavCollapsible), check sub-items first
if ('items' in item && item.items) {
const collapsibleItem = item as NavCollapsible
const items = collapsibleItem.items
const hrefWithoutQuery = href.split('?')[0]
// Check if any sub-item matches
if (
@@ -76,7 +81,6 @@ export function checkIsActive(
// Exact match
if (href === itemUrl) return true
const hrefWithoutQuery = href.split('?')[0]
const itemUrlWithoutQuery = itemUrl.split('?')[0]
const itemUrlHasQuery = itemUrl.includes('?')
+2
View File
@@ -18,6 +18,8 @@ type BaseNavItem = {
title: string
badge?: string
icon?: React.ElementType
activeUrls?: (LinkProps['to'] | (string & {}))[]
configUrls?: (LinkProps['to'] | (string & {}))[]
}
/**