Skip to content

Commit

Permalink
implement hide navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
FreakDev committed Oct 26, 2017
1 parent 62b9125 commit 28a7655
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/PageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down Expand Up @@ -83,7 +85,7 @@ export class PageManager extends Component {
}
</Switch>
</section>
{ navbars.map((navbar, k) => {
{ hideNavbarPath.indexOf(location.pathname) === -1 && navbars.map((navbar, k) => {
return React.cloneElement(navbar, { pages, key: k })
}) }
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ReactDOM.render(
return true
}}
>
<Page style={{ background: 'yellow' }} name="splash" exact path="/" noAnim >
<Page style={{ background: 'yellow' }} name="splash" exact path="/" noAnim noNavbar hideNavbar >
<h1>Splash</h1>
</Page>
<Page style={{ background: 'cyan' }} name="home" exact path="/home">
Expand Down

0 comments on commit 28a7655

Please sign in to comment.