import classNames from "classnames"; import Link from "next/link"; import { useRouter } from "next/router"; import React from "react"; import Typography, { ITypo } from "../../Typography"; import classes from "./classes.module.scss"; type IPropsClass = { text: string | JSX.Element; path?: string; isActive?: boolean; }; type IStateClass = {}; class HeaderLinkClass extends React.Component { public override render(): JSX.Element { if (this.props.path !== "" && this.props.path !== undefined) { return (
{this.props.text}
{this.props.isActive &&
} ); } else { return (
{this.props.text}
); } } } 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 */ const router = useRouter(); const { pathname } = router; const isActive = pathname === props.path; return ; }