improve date picker layout

This commit is contained in:
Bilal Catic
2019-06-18 15:25:24 +02:00
parent 16a62b35de
commit e5e86163ea

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import moment from 'moment'; import moment from 'moment';
import { Form, Message } from 'semantic-ui-react'; import { Form, Message, Grid } from 'semantic-ui-react';
import { defaultDateFormat } from '../../constants/constants'; import { defaultDateFormat } from '../../constants/constants';
@@ -81,31 +81,45 @@ class DateRangePicker extends Component {
return ( return (
<Form> <Form>
<Form.Group widths="equal"> <Grid columns="equal">
<Grid.Row>
<Grid.Column>
<label>{startDateLabel}</label>
<Form.Input <Form.Input
fluid fluid
required required
label={startDateLabel}
type="date" type="date"
value={startDateValue} value={startDateValue}
onChange={this.onStartDateChange.bind(this)} onChange={this.onStartDateChange.bind(this)}
/> />
</Grid.Column>
<Grid.Column>
<label>{endDateLabel}</label>
<Form.Input <Form.Input
fluid fluid
required required
label={endDateLabel}
type="date" type="date"
value={endDateValue} value={endDateValue}
onChange={this.onEndDateChange.bind(this)} onChange={this.onEndDateChange.bind(this)}
/> />
</Form.Group> </Grid.Column>
</Grid.Row>
{ error && { error &&
<Grid.Row>
<Grid.Column>
<Message color="orange" onDismiss={this.onDismiss.bind(this)}> <Message color="orange" onDismiss={this.onDismiss.bind(this)}>
<Message.Header>Wrong date</Message.Header> <Message.Header>Wrong date</Message.Header>
<p><b>{startDateLabel}</b> has to be before <b>{endDateLabel}</b></p> <p><b>{startDateLabel}</b> has to be before <b>{endDateLabel}</b></p>
</Message> </Message>
</Grid.Column>
</Grid.Row>
} }
<Grid.Row>
<Grid.Column>
<Form.Button onClick={this.onButtonClick.bind(this)}>{buttonLabel}</Form.Button> <Form.Button onClick={this.onButtonClick.bind(this)}>{buttonLabel}</Form.Button>
</Grid.Column>
</Grid.Row>
</Grid>
</Form> </Form>
); );
} }