-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
42 lines (38 loc) · 1.15 KB
/
index.tsx
File metadata and controls
42 lines (38 loc) · 1.15 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
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon';
import classNames from 'classnames';
import type { ComponentProps, FC, PropsWithChildren } from 'react';
import styles from './index.module.css';
type BreadcrumbItemProps = {
disableMicrodata?: boolean;
hidden?: boolean;
hideSeparator?: boolean;
position?: number;
} & ComponentProps<'li'>;
const BreadcrumbItem: FC<PropsWithChildren<BreadcrumbItemProps>> = ({
disableMicrodata,
children,
hidden = false,
hideSeparator = false,
position,
...props
}) => (
<li
{...props}
itemProp={!disableMicrodata ? 'itemListElement' : undefined}
itemScope={!disableMicrodata ? true : undefined}
itemType={!disableMicrodata ? 'https://schema.org/ListItem' : undefined}
className={classNames(
styles.item,
{ [styles.visuallyHidden]: hidden },
props.className
)}
aria-hidden={hidden ? 'true' : undefined}
>
{children}
{position && <meta itemProp="position" content={`${position}`} />}
{!hideSeparator && (
<ChevronRightIcon aria-hidden="true" className={styles.separator} />
)}
</li>
);
export default BreadcrumbItem;