-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
46 lines (39 loc) · 1.08 KB
/
index.tsx
File metadata and controls
46 lines (39 loc) · 1.08 KB
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
38
39
40
41
42
43
44
45
46
import { ArrowUpRightIcon } from '@heroicons/react/24/solid';
import classNames from 'classnames';
import type { FC } from 'react';
import BaseActiveLink from '#ui/Common/BaseActiveLink';
import type { FormattedMessage, LinkLike } from '#ui/types';
import styles from './index.module.css';
import ProgressionIcon from '../ProgressionIcon';
type SidebarItemProps = {
label: FormattedMessage;
link: string;
as?: LinkLike;
pathname?: string;
showProgressionIcons?: boolean;
};
const SidebarItem: FC<SidebarItemProps> = ({
label,
link,
showProgressionIcons = false,
...props
}) => (
<BaseActiveLink
className={classNames({
[styles.item]: true,
[styles.progression]: showProgressionIcons,
})}
href={link}
activeClassName={styles.active}
{...props}
>
{showProgressionIcons && (
<ProgressionIcon className={styles.progressionIcon} />
)}
<div className={styles.label}>
<span>{label}</span>
{/^https?:/.test(link) && <ArrowUpRightIcon className={styles.icon} />}
</div>
</BaseActiveLink>
);
export default SidebarItem;