Skip to content

Commit

Permalink
fix: exclude header active status
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Feb 14, 2024
1 parent 84ed850 commit bf8b3ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/layout/header/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export interface IHeaderMenu {
path: string
type?: string
icon?: ReactNode
subMenu?: IHeaderMenu[]
subMenu?: Omit<IHeaderMenu, 'exclude'>[]
exclude?: string[]
}
export const headerMenuConfig: IHeaderMenu[] = [
{
Expand All @@ -43,6 +44,7 @@ export const headerMenuConfig: IHeaderMenu[] = [
type: 'Note',
path: '/notes',
icon: h(FaSolidFeatherAlt),
exclude: ['/notes/topics'],
},

{
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout/header/internal/HeaderContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ const ForDesktop: Component<{
subItemActive={section.subMenu?.[subItemActive]}
isActive={
pathname === section.path ||
pathname.startsWith(`${section.path}/`) ||
(pathname.startsWith(`${section.path}/`) &&
!section.exclude?.includes(pathname)) ||
subItemActive > -1 ||
false
}
Expand Down

0 comments on commit bf8b3ab

Please sign in to comment.