summaryrefslogtreecommitdiffstats
path: root/ui/src/components/create-post.tsx
blob: 51e992111ccfc686ae1ed62ccf81bda0844fe79b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Component, linkEvent } from 'inferno';
import { PostForm } from './post-form';

export class CreatePost extends Component<any, any> {

  constructor(props, context) {
    super(props, context);
    this.handlePostCreate = this.handlePostCreate.bind(this);
  }

  render() {
    return (
      <div class="container">
        <div class="row">
          <div class="col-12 col-lg-6 mb-4">
            <h3>Create a Post</h3>
            <PostForm onCreate={this.handlePostCreate}/>
          </div>
        </div>
      </div>
    )
  }

  handlePostCreate(id: number) {
    this.props.history.push(`/post/${id}`);
  }
}