Skip to content

Commit

Permalink
updated lable to label and fix conflict in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
okeino committed Jan 4, 2024
2 parents 3da1ffd + 2811ccb commit b089eb2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/components/atoms/activeLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import Link, { LinkProps } from 'next/link';
import { useRouter } from 'next/router';
import React, { ReactElement } from 'react';

import { analytics } from './analytics';

type ActiveLinkProps = LinkProps & {
children: ReactElement;
className?: string;
activeClassName: string;
linkLabel?: string;
};

// SOURCE: https://zaiste.net/programming/reactjs/howtos/create-activelink-nextjs/
Expand All @@ -15,6 +18,7 @@ const ActiveLink = ({
children,
className,
activeClassName,
linkLabel,
...props
}: ActiveLinkProps): JSX.Element => {
const { asPath } = useRouter();
Expand All @@ -29,6 +33,9 @@ const ActiveLink = ({
<a
className={clsx(className, isActive && activeClassName)}
aria-current={isActive ? 'page' : false}
onClick={() => {
analytics.track('menuClick', { lable: linkLabel });
}}
>
{children}
</a>
Expand Down
10 changes: 9 additions & 1 deletion src/components/molecules/navItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import styles from '~components/organisms/navigation.module.scss';
import { INavigationItem } from '~lib/useNavigationItems';
import IconDisclosure from '~public/img/icons/icon-disclosure-light-small.svg';

import { analytics } from '../atoms/analytics';

export default function NavItem({
item,
setSubmenu,
Expand All @@ -29,11 +31,17 @@ export default function NavItem({
href={href}
className={styles.navLink}
activeClassName={styles.active}
linkLabel={label}
>
{inner}
</ActiveLink>
) : (
<a className={styles.navLink} onClick={() => setSubmenu(key)}>
<a
className={styles.navLink}
onClick={() => {
analytics.track('menuClick', { link: label }), setSubmenu(key);
}}
>
{inner}
</a>
)}
Expand Down

0 comments on commit b089eb2

Please sign in to comment.