This commit is contained in:
Florian Scholdei
2019-06-26 15:17:16 +02:00
parent 1729e5ff4f
commit 3d07b6c12b

View File

@@ -1,21 +1,34 @@
//@flow //@flow
import React from "react"; import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import injectSheet from "react-jss";
import classNames from "classnames";
type Props = { type Props = {
path: string, path: string,
baseUrl: string baseUrl: string,
classes: any
};
const styles = {
margin: {
margin: "1rem 1.25rem 0rem"
}
}; };
class Breadcrumb extends React.Component<Props> { class Breadcrumb extends React.Component<Props> {
render() { render() {
const { path, baseUrl } = this.props; const { path, baseUrl, classes } = this.props;
if (path) { if (path) {
const paths = path.split("/"); const paths = path.split("/");
return ( return (
<nav className="breadcrumb" aria-label="breadcrumbs"> <>
<nav
className={classNames("breadcrumb", classes.margin)}
aria-label="breadcrumbs"
>
<ul> <ul>
{paths.map((path, index) => { {paths.map((path, index) => {
if (paths.length - 1 === index) { if (paths.length - 1 === index) {
@@ -35,10 +48,12 @@ class Breadcrumb extends React.Component<Props> {
})} })}
</ul> </ul>
</nav> </nav>
<hr />
</>
); );
} }
return null; return null;
} }
} }
export default Breadcrumb; export default injectSheet(styles)(Breadcrumb);