Add page object with top-level routes
This commit is contained in:
parent
687b378a8c
commit
e69c47e2c4
3 changed files with 82 additions and 21 deletions
23
src/App.js
23
src/App.js
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue