Extended GroupForm

This commit is contained in:
Philipp Czora
2018-07-31 16:39:07 +02:00
parent 4d4457aa3d
commit 3ba9e04c11
2 changed files with 26 additions and 3 deletions

View File

@@ -2,18 +2,40 @@
import React from 'react';
import InputField from "../../components/forms/InputField"
import SubmitButton from "../../components/buttons/SubmitButton"
import type { Group } from "../types/Group"
export interface Props {
loading?: boolean,
submitForm: Group => void
}
export interface State {
group: Group
}
class GroupForm extends React.Component<Props, State> {
isValid = () => {
return true;
}
submit = (event: Event) => {
event.preventDefault();
this.props.submitForm(this.state.group)
}
render() {
const { loading } = this.props;
return (
<form>
<InputField label="Name" errorMessage="" onChange={()=>{}} validationError={false}/>
// TODO: i18n
<form onSubmit={this.submit}>
<InputField label="Name" errorMessage="Invalid group name" onChange={()=>{}} validationError={false}/>
<InputField label="Description" errorMessage="Invalid group description" onChange={()=>{}} validationError={false} />
<SubmitButton
disabled={!this.isValid()}
loading={loading}
label="Submit"
/>
</form>
)
}