diff --git a/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx b/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx index a2af0095..d8db1a7e 100644 --- a/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx +++ b/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx @@ -6,12 +6,15 @@ import React from "react"; import Typography, { ITypo } from "../../Typography"; import classes from "./classes.module.scss"; -type IPropsClass = { +type IProps = { text: string | JSX.Element; - path?: string; + path: string; isActive?: boolean; + routesActive: string[]; }; +type IPropsClass = IProps; + type IStateClass = {}; class HeaderLinkClass extends React.Component { @@ -37,14 +40,13 @@ class HeaderLinkClass extends React.Component { } } -export default function HeaderLink(props: IPropsClass) { - /** - * TODO: We need to fix the check and include subPathName - * BUT - * `/folder/archived` and `/folder/xxx` should be differenciated - */ +export default function HeaderLink(props: IProps) { const router = useRouter(); const { pathname } = router; - const isActive = pathname === props.path; + let isActive = props.path === pathname; + for (const routeActive of props.routesActive) { + if (isActive) break; + isActive = pathname.includes(routeActive); + } return ; } diff --git a/src/front/Components/DesignSystem/Header/Navigation/index.tsx b/src/front/Components/DesignSystem/Header/Navigation/index.tsx index 0319b1a3..0a1427a5 100644 --- a/src/front/Components/DesignSystem/Header/Navigation/index.tsx +++ b/src/front/Components/DesignSystem/Header/Navigation/index.tsx @@ -1,8 +1,8 @@ +import Module from "@Front/Config/Module"; import React from "react"; import HeaderLink from "../HeaderLink"; import classes from "./classes.module.scss"; -import Module from "@Front/Config/Module"; type IProps = {}; type IState = {}; @@ -11,10 +11,15 @@ export default class Navigation extends React.Component { public override render(): JSX.Element { return (
- +
);