-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
37 lines (32 loc) · 788 Bytes
/
index.tsx
File metadata and controls
37 lines (32 loc) · 788 Bytes
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 classNames from 'classnames';
import type { ComponentProps, FC } from 'react';
import type { LinkLike } from '#ui/types';
import styles from './index.module.css';
type BreadcrumbLinkProps = {
active?: boolean;
as: LinkLike;
} & ComponentProps<LinkLike>;
const BreadcrumbLink: FC<BreadcrumbLinkProps> = ({
href,
active,
as: Component = 'a',
...props
}) => (
<Component
itemScope
itemType="http://schema.org/Thing"
itemProp="item"
itemID={href?.toString()}
href={href}
className={classNames(
styles.link,
{ [styles.active]: active },
props.className
)}
aria-current={active ? 'page' : undefined}
{...props}
>
<span itemProp="name">{props.children}</span>
</Component>
);
export default BreadcrumbLink;