Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions client/src/components/HeaderComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ import React from 'react';
import Toolbar from 'components/Toolbar/Toolbar';
import { Component as Breadcrumb } from 'components/Breadcrumb/Breadcrumb';

const HeaderComponent = ({ breadcrumbs }) => {
const HeaderComponent = ({ breadcrumbs, currentPath }) => {

const breadcrumb = () => {
const urlSegments = window.location.pathname.split('/');
let crumbs = [];
breadcrumbs.forEach(breadcrumb => {
let crumb = {}
if (urlSegments.includes(breadcrumb.href)) {
crumb.text = breadcrumb.text
crumb.href = `${currentPath}/${breadcrumb.href}`;
crumbs.push(crumb);
}
});
return crumbs;
}

return (
<Toolbar className="fill-width">
<Breadcrumb multiline crumbs={breadcrumbs} />
<Breadcrumb multiline crumbs={breadcrumb()} />
</Toolbar>
);
};
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/LeftAndMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import ActionBar from "./ActionBar";
* @returns {JSX.Element}
* @constructor
*/
const LeftAndMain = ({ children, topActions, bottomActions, breadcrumbs }) => {
const LeftAndMain = ({ children, topActions, bottomActions, breadcrumbs, currentPath }) => {
return (
<div className="left-and-main fill-height">
<HeaderComponent breadcrumbs={breadcrumbs} />
<HeaderComponent breadcrumbs={breadcrumbs} currentPath={currentPath} />
<div className="panel panel--padded panel--scrollable">
{topActions.length > 0 && <ActionBar actions={topActions} />}
{children}
Expand Down