-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathBreadCrumbs.tsx
More file actions
55 lines (49 loc) · 926 Bytes
/
BreadCrumbs.tsx
File metadata and controls
55 lines (49 loc) · 926 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { FC, HTMLAttributes } from 'react';
import classnames from 'classnames';
/**
*
*/
export type CrumbProps = HTMLAttributes<HTMLLIElement> & {
href?: string;
};
/**
*
*/
export const Crumb: FC<CrumbProps> = ({
className,
href,
children,
...props
}) => {
const text = children;
const cClassName = classnames('slds-breadcrumb__item', className);
return (
<li {...props} className={cClassName}>
<a href={href}>{text}</a>
</li>
);
};
/**
*
*/
export type BreadCrumbsProps = HTMLAttributes<HTMLElement>;
/**
*
*/
export const BreadCrumbs: FC<BreadCrumbsProps> = ({
className,
children,
...props
}) => {
const oClassName = classnames(
'slds-breadcrumb',
'slds-list_horizontal',
'slds-wrap',
className
);
return (
<nav {...props} role='navigation' aria-label='Breadcrumbs'>
<ol className={oClassName}>{children}</ol>
</nav>
);
};