diff --git a/apps/webapp/src/components/Link/Link.tsx b/apps/webapp/src/components/Link/Link.tsx index 93a842c4..b506b7ae 100644 --- a/apps/webapp/src/components/Link/Link.tsx +++ b/apps/webapp/src/components/Link/Link.tsx @@ -11,22 +11,26 @@ import * as s from './Link.css' export type LinkProps = ComponentPropsWithoutRef<'a'> & { activeClass?: string + activeUrlPrefix?: string children: ReactNode } export const Link = forwardRef(function Link( - { className, activeClass, ...rest }, + { className, activeClass, activeUrlPrefix, ...rest }, ref, ) { const pageContext = usePageContext() + const isActive = activeUrlPrefix + ? pageContext.urlPathname.startsWith(activeUrlPrefix) + : pageContext.urlPathname === rest.href + return ( { className={s.navLink} asChild > - +