]> Untitled Git - lemmy.git/blob - ui/src/components/create-community.tsx
Merge branch 'master' into master
[lemmy.git] / ui / src / components / create-community.tsx
1 import { Component } from 'inferno';
2 import { CommunityForm } from './community-form';
3 import { Community } from '../interfaces';
4 import { WebSocketService } from '../services';
5 import { i18n } from '../i18next';
6 import { T } from 'inferno-i18next';
7
8 export class CreateCommunity extends Component<any, any> {
9   constructor(props: any, context: any) {
10     super(props, context);
11     this.handleCommunityCreate = this.handleCommunityCreate.bind(this);
12   }
13
14   componentDidMount() {
15     document.title = `${i18n.t('create_community')} - ${
16       WebSocketService.Instance.site.name
17     }`;
18   }
19
20   render() {
21     return (
22       <div class="container">
23         <div class="row">
24           <div class="col-12 col-lg-6 offset-lg-3 mb-4">
25             <h5>
26               <T i18nKey="create_community">#</T>
27             </h5>
28             <CommunityForm onCreate={this.handleCommunityCreate} />
29           </div>
30         </div>
31       </div>
32     );
33   }
34
35   handleCommunityCreate(community: Community) {
36     this.props.history.push(`/c/${community.name}`);
37   }
38 }