Refactor breadcrumbs, tabs, routing.

* Cleanup previous params logic from Notificaitons list
* Add shared breadcrumbs and tabs components
* Structure Organization screens to render only cardBody content
* Add styles
* Fetch organization when location changes
This commit is contained in:
Marliana Lara
2019-01-24 23:53:10 -05:00
parent dd522c240e
commit b820e411d3
18 changed files with 363 additions and 356 deletions

View File

@@ -0,0 +1,70 @@
import React, { Fragment } from 'react';
import {
PageSection,
PageSectionVariants,
Breadcrumb,
BreadcrumbItem,
BreadcrumbHeading
} from '@patternfly/react-core';
import {
Link,
Route,
withRouter
} from 'react-router-dom';
import './breadcrumbs.scss';
const Breadcrumbs = ({ breadcrumbConfig }) => {
const { light } = PageSectionVariants;
return (
<PageSection
variant={light}
className="pf-m-condensed"
>
<Breadcrumb>
<Route
render={(props) => <Crumb breadcrumbConfig={breadcrumbConfig} {...props} />}
/>
</Breadcrumb>
</PageSection>
);
};
const Crumb = ({ breadcrumbConfig, match }) => {
const crumb = breadcrumbConfig[match.url];
let crumbElement = (
<BreadcrumbItem key={match.url}>
<Link to={match.url}>
{crumb}
</Link>
</BreadcrumbItem>
);
if (match.isExact) {
crumbElement = (
<BreadcrumbHeading
key="breadcrumb-heading"
className="heading"
>
{crumb}
</BreadcrumbHeading>
);
}
if (!crumb) {
crumbElement = null;
}
return (
<Fragment>
{crumbElement}
<Route
path={`${match.url}/:path`}
render={(props) => <Crumb breadcrumbConfig={breadcrumbConfig} {...props} />}
/>
</Fragment>
);
};
export default withRouter(Breadcrumbs);

View File

@@ -0,0 +1,15 @@
.pf-c-breadcrumb__item {
text-transform: capitalize;
}
.pf-c-breadcrumb__item.heading {
--pf-c-breadcrumb__heading--FontSize: 20px;
line-height: 24px;
flex: 100%;
}
.pf-c-breadcrumb__item:nth-last-child(2) {
.pf-c-breadcrumb__item-divider {
display: none;
}
}