2019-04-08 01:19:02 -04:00
|
|
|
import { Component } from 'inferno';
|
2019-04-03 16:59:37 -04:00
|
|
|
import { PostForm } from './post-form';
|
2019-03-22 21:42:57 -04:00
|
|
|
|
2019-04-03 16:59:37 -04:00
|
|
|
export class CreatePost extends Component<any, any> {
|
2019-03-26 14:00:18 -04:00
|
|
|
|
2019-04-08 01:19:02 -04:00
|
|
|
constructor(props: any, context: any) {
|
2019-03-22 21:42:57 -04:00
|
|
|
super(props, context);
|
2019-04-03 16:59:37 -04:00
|
|
|
this.handlePostCreate = this.handlePostCreate.bind(this);
|
2019-03-26 14:00:18 -04:00
|
|
|
}
|
2019-03-22 21:42:57 -04:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 col-lg-6 mb-4">
|
2019-04-04 20:01:10 -04:00
|
|
|
<h4>Create a Post</h4>
|
2019-04-03 16:59:37 -04:00
|
|
|
<PostForm onCreate={this.handlePostCreate}/>
|
2019-03-22 21:42:57 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-04-03 16:59:37 -04:00
|
|
|
handlePostCreate(id: number) {
|
|
|
|
this.props.history.push(`/post/${id}`);
|
2019-03-26 14:00:18 -04:00
|
|
|
}
|
2019-04-03 16:59:37 -04:00
|
|
|
}
|
2019-03-26 14:00:18 -04:00
|
|
|
|
2019-03-22 21:42:57 -04:00
|
|
|
|