From 28a765519e9763e8bdff77fce0f59537adbbf4a5 Mon Sep 17 00:00:00 2001 From: Mathias Desloges Date: Thu, 26 Oct 2017 23:36:45 +0200 Subject: [PATCH] implement hide navbar --- src/PageManager.js | 10 ++++++---- src/index.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/PageManager.js b/src/PageManager.js index 65c1e5c..be8cf68 100644 --- a/src/PageManager.js +++ b/src/PageManager.js @@ -39,10 +39,12 @@ export class PageManager extends Component { const currentKey = location.pathname.split("/")[1] || "/"; const timeout = { enter: 500, exit: 500 }; const routes = children.filter( c => c.type === Page ) - const animatedPages = children.filter( r => !r.props.noAnim ) - const notAnimatedPages = children.filter( r => r.props.noAnim ) + const animatedPages = routes.filter( r => !r.props.noAnim ) + const notAnimatedPages = routes.filter( r => r.props.noAnim ) + const hideNavbarPath = routes.filter( r => r.props.hideNavbar ).map(r => r.props.path) + const pages = routes.filter(r => !r.props.noNavbar).map(r => ({ name: r.props.name, path: r.props.path })) - const navbars = children.filter(child => child.type === NavigationBar) + const navbars = children.filter(child => child.type === NavigationBar ) const forbiddenPage = children.find( c => c.type === ForbiddenPage ) @@ -83,7 +85,7 @@ export class PageManager extends Component { } - { navbars.map((navbar, k) => { + { hideNavbarPath.indexOf(location.pathname) === -1 && navbars.map((navbar, k) => { return React.cloneElement(navbar, { pages, key: k }) }) } diff --git a/src/index.js b/src/index.js index 44326fa..b9e2646 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,7 @@ ReactDOM.render( return true }} > - +

Splash