mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
f0d6e45361
* feat: add bootstrap endpoint redux integration * fix: remove useEffect from app * feat: add path provider * feat: browser router * fix: delete path formatter * fix: return absolute path if no basepath * fix: format seenURI * feat: get bootstrap uri from html * fix: remove unused imports * fix: remove initial loading call * fix: wrap logout in formatApiPath * feat: import logo * feat: remove accessor from receiveConfig * fix: update tests * fix: update asset paths * fix: remove data from app * fix: revert moving access provider * fix: remove build watch * fix: remove console logs * fix: update asset paths * fix: remove path logic from base64 * fix: remove unused import * set uiconfig * change notification text * fix: match uiConfig with expected format * feat: add proclamation * fix: move proclamation * fix: remove unused imports * fix: add target _blank * fix: allow optional toast * fix: return empty string if default value is present * fix: set basepath to empty string if it matches default
69 lines
1.6 KiB
JavaScript
69 lines
1.6 KiB
JavaScript
import React from 'react';
|
||
import { Link, Route, Switch } from 'react-router-dom';
|
||
|
||
import { routes, getRoute } from './routes';
|
||
|
||
import styles from '../styles.module.scss';
|
||
|
||
const renderDoubleBread = (currentTitle, parentRoute) => {
|
||
document.title = `${currentTitle} - ${parentRoute.title} - Unleash`;
|
||
return (
|
||
<span>
|
||
<Link className={styles.headerTitleLink} to={parentRoute.path}>
|
||
{parentRoute.title}
|
||
</Link>
|
||
<span>
|
||
<span> › </span>
|
||
<span className={styles.headerTitleLink}>{currentTitle}</span>
|
||
</span>
|
||
</span>
|
||
);
|
||
};
|
||
|
||
const renderBread = route => {
|
||
document.title = `${route.title} - Unleash`;
|
||
return (
|
||
<span>
|
||
<span className={styles.headerTitleLink}>{route.title}</span>
|
||
</span>
|
||
);
|
||
};
|
||
|
||
const renderRoute = (params, route) => {
|
||
if (!route) {
|
||
return null;
|
||
}
|
||
const title = route.title.startsWith(':')
|
||
? params[route.title.substring(1)]
|
||
: route.title;
|
||
return route.parent
|
||
? renderDoubleBread(title, getRoute(route.parent))
|
||
: renderBread(route);
|
||
};
|
||
|
||
/*
|
||
Render the breadcrumb.
|
||
|
||
We only support two levels.
|
||
|
||
Examples:
|
||
- Features
|
||
- Features > Create
|
||
- Features > SomeToggle
|
||
*/
|
||
const Breadcrumb = () => (
|
||
<Switch>
|
||
{routes.map(route => (
|
||
<Route
|
||
key={route.path}
|
||
path={route.path}
|
||
render={({ match: { params } } = this.props) =>
|
||
renderRoute(params, route)
|
||
}
|
||
/>
|
||
))}
|
||
</Switch>
|
||
);
|
||
|
||
export default Breadcrumb;
|