-
Notifications
You must be signed in to change notification settings - Fork 344
Expand file tree
/
Copy pathBreadcrumb.tsx
More file actions
31 lines (27 loc) · 880 Bytes
/
Breadcrumb.tsx
File metadata and controls
31 lines (27 loc) · 880 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
import * as React from 'react';
import { TextButton } from '@box/blueprint-web';
import BreadcrumbDelimiter from './BreadcrumbDelimiter';
import type { Delimiter } from '../../../common/types/core';
import './Breadcrumb.scss';
export interface BreadcrumbProps {
delimiter?: Delimiter;
isLast?: boolean;
name: string;
onClick?: () => void;
}
const Breadcrumb = ({ name = '', onClick, isLast, delimiter }: BreadcrumbProps) => {
const title = onClick ? (
<TextButton className="bdl-Breadcrumb-title" inheritFont onClick={onClick}>
{name}
</TextButton>
) : (
<div className="bdl-Breadcrumb-title">{name}</div>
);
return (
<span className="be-breadcrumb">
{title}
{isLast ? null : <BreadcrumbDelimiter delimiter={delimiter} />}
</span>
);
};
export default Breadcrumb;