Add page object with top-level routes

This commit is contained in:
Nick Pegg 2017-10-07 19:33:16 -07:00
parent 687b378a8c
commit e69c47e2c4
3 changed files with 82 additions and 21 deletions

View file

@ -16,6 +16,7 @@ import { Header } from './Header';
import { NavList, TagNav } from './Nav';
import { NotFound } from './NotFound';
import { Post, Posts } from './Post';
import { Page } from './Page';
class App extends Component {
@ -40,13 +41,14 @@ class App extends Component {
<Column width="eight">
<Switch>
<Route exact path="/" component={Posts} />
{ /* Page routes */ }
<Route path="/about" component={About} />
{ /* Post routes */ }
<Route path="/page/:page" component={Posts} />
<Route path="/:year/:month/:slug" component={Post} />
{ /* Page routes */ }
<Route path="/:slug" component={Page} />
{ /* 404 fallback */ }
<Route component={NotFound} />
</Switch>
@ -85,22 +87,5 @@ class ScrollToTop extends Component {
}
ScrollToTop = withRouter(ScrollToTop);
// Dummy About page just for playing around with ReactRouter
class About extends Component {
render () {
return (
<article>
<header>
<h1>About me</h1>
</header>
<section>
<p>
Wowzers, this is an about page!
</p>
</section>
</article>
)
}
}
export default App;