forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
37 lines (30 loc) · 880 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ArrowUpRightIcon } from '@heroicons/react/24/solid';
import classNames from 'classnames';
import type { FC, PropsWithChildren } from 'react';
import ActiveLink from '@/components/Common/ActiveLink';
import styles from './index.module.css';
type NavItemType = 'nav' | 'footer';
type NavItemProps = {
href: string;
type?: NavItemType;
className?: string;
};
const NavItem: FC<PropsWithChildren<NavItemProps>> = ({
href = '',
type = 'nav',
children,
className,
}) => (
<ActiveLink
href={href}
className={classNames(styles.navItem, styles[type], className)}
activeClassName={styles.active}
allowSubPath={href.startsWith('/')}
>
<span className={styles.label}>{children}</span>
{type === 'nav' && href.startsWith('http') && (
<ArrowUpRightIcon className={styles.icon} />
)}
</ActiveLink>
);
export default NavItem;