Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
Extracted navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Mar 10, 2017
1 parent 47572b8 commit 1cc645f
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/app/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ function Header({ intl }) {
Header = injectIntl(Header)


function Navigation({ intl }) {
return (
<ul>
<li><NavLink exact to="/" activeClassName={Styles.activeLink}>Home</NavLink></li>
<li><NavLink to="/about" activeClassName={Styles.activeLink}>About</NavLink></li>
<li><NavLink to="/missing" activeClassName={Styles.activeLink}>Missing</NavLink></li>
</ul>
)
}

Navigation = injectIntl(Navigation)



const HomeComponent = createLazyComponent({
id: "home",
Expand Down Expand Up @@ -71,22 +84,12 @@ function Root({ children, locale, language, intl }) {
<IntlProvider locale={locale} messages={messages}>
<main>
<Header/>

<div>
<ul>
<li><NavLink exact to="/" activeClassName={Styles.activeLink}>Home</NavLink></li>
<li><NavLink to="/about" activeClassName={Styles.activeLink}>About</NavLink></li>
<li><NavLink to="/missing" activeClassName={Styles.activeLink}>Missing</NavLink></li>
</ul>
</div>

<div>
<Switch>
<Route exact path="/" component={HomeComponent} />
<Route path="/about" component={AboutComponent} />
<Route component={Error404}/>
</Switch>
</div>
<Navigation/>
<Switch>
<Route exact path="/" component={HomeComponent} />
<Route path="/about" component={AboutComponent} />
<Route component={Error404}/>
</Switch>
</main>
</IntlProvider>
)
Expand Down

0 comments on commit 1cc645f

Please sign in to comment.