Add post container, component and route

This commit is contained in:
LordMathis 2017-11-07 17:25:35 +01:00
parent a026c1f321
commit e642c81472
3 changed files with 31 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Route, Switch } from 'react-router-dom'; import { Route, Switch } from 'react-router-dom';
import { Home, About, Portfolio, Resume, NotFoundPage } from '.'; import { Home, About, Portfolio, Resume, NotFoundPage } from '.';
import { BlogContainer } from '../containers'; import { BlogContainer, PostContainer } from '../containers';
export const App = () => ( export const App = () => (
<div> <div>
@ -9,6 +9,7 @@ export const App = () => (
<Switch> <Switch>
<Route exact path="/about" component={About} /> <Route exact path="/about" component={About} />
<Route exact path="/blog" component={BlogContainer} /> <Route exact path="/blog" component={BlogContainer} />
<Route path="/blog/post/:postname" component={PostContainer} />
<Route exact path="/portfolio" component={Portfolio} /> <Route exact path="/portfolio" component={Portfolio} />
<Route exact path="/resume" component={Resume} /> <Route exact path="/resume" component={Resume} />
<Route component={NotFoundPage} /> <Route component={NotFoundPage} />

9
src/components/Post.js Normal file
View File

@ -0,0 +1,9 @@
import React, {Component} from 'react';
export default class Post extends Component {
render() {
return (
<div>Hello</div>
)
}
}

View File

@ -0,0 +1,20 @@
import React, {Component} from 'react';
import axios from 'axios';
import {Post} from '../components';
export default class PostContainer extends Component {
constructor() {
super();
this.state = {
isLoading: true,
};
}
render() {
return (
<Post isLoading={this.state.isLoading}
post={this.state.post} />
)
}
}