Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz> Reviewed-on: http://git.tnsu.kz/gorbenko.pavel/tnsu-approval-route/pulls/5
This commit was merged in pull request #5.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import * as React from 'react';
|
||||
import styles from './PageChrome.module.scss';
|
||||
|
||||
export interface IBreadcrumbItem {
|
||||
label: string;
|
||||
/** Без onClick пункт неинтерактивен — это текущая страница. */
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export interface IBreadcrumbsProps {
|
||||
items: IBreadcrumbItem[];
|
||||
}
|
||||
|
||||
export const Breadcrumbs: React.FC<IBreadcrumbsProps> = ({ items }) => (
|
||||
<div className={styles.bread}>
|
||||
{items.map((item, index) => (
|
||||
<React.Fragment key={item.label}>
|
||||
{index > 0 && <span className={styles.sep}>◆</span>}
|
||||
{item.onClick ? (
|
||||
<button className={styles.breadLink} onClick={item.onClick}>{item.label}</button>
|
||||
) : (
|
||||
<span>{item.label}</span>
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user