blob: c5a17b808e00bed55087ab25f5c9656271e70c0e (
plain)
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
47
48
49
50
|
import React, { Children, FC } from "react";
import Link from "next/link";
import styles from './breadcrumbs.module.scss';
import clsx from 'clsx';
export type BreadcrumbsProps = {
className?: string;
style?: object;
};
const Breadcrumbs : FC<BreadcrumbsProps> = ({children, className, ...props}) => (
<span className={clsx(styles.breadcrumbs, className)} {...props}>
{Children.map(children, (child, index) => {
return (
<>
{
index !== 0 ? (
<span className={styles.divider}>/</span>
) : undefined
}
{child}
</>
);
})}
</span>
);
const Crumb : FC = ({children, ...props}) => (
<span className={styles.crumb} {...props}>
{children}
</span>
);
export type LinkCrumbProps = {
href: string;
}
const LinkCrumb : FC<LinkCrumbProps> = ({children, href, ...props}) => (
<Crumb>
<Link href={href}>
<a>{children}</a>
</Link>
</Crumb>
);
export {
Crumb,
Breadcrumbs,
LinkCrumb
};
|