Event Edit: upgrade material-ui.

master
Tom Hacohen 6 years ago
parent 6a0b94fa0e
commit c1d446551b

@ -1,14 +1,20 @@
import * as React from 'react'; import * as React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import Toggle from 'material-ui/Toggle';
import TextField from 'material-ui/TextField';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import { red500, fullWhite } from 'material-ui/styles/colors';
import IconDelete from 'material-ui/svg-icons/action/delete';
import IconCancel from 'material-ui/svg-icons/content/clear'; import FormGroup from '@material-ui/core/FormGroup';
import IconSave from 'material-ui/svg-icons/content/save'; import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
import FormControl from '@material-ui/core/FormControl';
import InputLabel from '@material-ui/core/InputLabel';
import * as colors from '@material-ui/core/colors';
import IconDelete from '@material-ui/icons/Delete';
import IconCancel from '@material-ui/icons/Clear';
import IconSave from '@material-ui/icons/Save';
import DateTimePicker from '../widgets/DateTimePicker'; import DateTimePicker from '../widgets/DateTimePicker';
@ -197,6 +203,7 @@ class EventEdit extends React.PureComponent {
fullWidth: { fullWidth: {
width: '100%', width: '100%',
boxSizing: 'border-box' as any, boxSizing: 'border-box' as any,
marginTop: 16,
}, },
submit: { submit: {
marginTop: 40, marginTop: 40,
@ -225,30 +232,40 @@ class EventEdit extends React.PureComponent {
<form style={styles.form} onSubmit={this.onSubmit}> <form style={styles.form} onSubmit={this.onSubmit}>
<TextField <TextField
name="title" name="title"
hintText="Enter title" placeholder="Enter title"
style={styles.fullWidth} style={styles.fullWidth}
value={this.state.title} value={this.state.title}
onChange={this.handleInputChange} onChange={this.handleInputChange}
/> />
<SelectField <FormControl disabled={this.props.item !== undefined} style={styles.fullWidth} >
style={styles.fullWidth} <InputLabel>
Saving to
</InputLabel>
<Select
value={this.state.journalUid} value={this.state.journalUid}
floatingLabelText="Saving to"
disabled={this.props.item !== undefined} disabled={this.props.item !== undefined}
onChange={(event: object, key: number, payload: any) => this.handleChange('journalUid', payload)} onChange={this.handleInputChange}
> >
{this.props.collections.map((x) => ( {this.props.collections.map((x) => (
<MenuItem key={x.uid} value={x.uid} primaryText={x.displayName} /> <MenuItem key={x.uid} value={x.uid}>{x.displayName}</MenuItem>
))} ))}
</SelectField> </Select>
</FormControl>
<Toggle <FormGroup>
label="All Day" <FormControlLabel
control={
<Switch
name="allDay" name="allDay"
toggled={this.state.allDay} checked={this.state.allDay}
onToggle={this.toggleAllDay} onChange={this.toggleAllDay}
color="primary"
/>
}
label="All Day"
/> />
</FormGroup>
<div> <div>
<DateTimePicker <DateTimePicker
@ -270,7 +287,7 @@ class EventEdit extends React.PureComponent {
<TextField <TextField
name="location" name="location"
hintText="Add location" placeholder="Add location"
style={styles.fullWidth} style={styles.fullWidth}
value={this.state.location} value={this.state.location}
onChange={this.handleInputChange} onChange={this.handleInputChange}
@ -278,38 +295,42 @@ class EventEdit extends React.PureComponent {
<TextField <TextField
name="description" name="description"
hintText="Add description" placeholder="Add description"
multiLine={true} multiline={true}
style={styles.fullWidth} style={styles.fullWidth}
value={this.state.description} value={this.state.description}
onChange={this.handleInputChange} onChange={this.handleInputChange}
/> />
<div style={styles.submit}> <div style={styles.submit}>
<RaisedButton <Button
label="Cancel" variant="raised"
icon={<IconCancel />}
onClick={this.props.onCancel} onClick={this.props.onCancel}
/> >
<IconCancel style={{marginRight: 8}} />
Cancel
</Button>
{this.props.item && {this.props.item &&
<RaisedButton <Button
label="Delete" variant="raised"
labelColor={fullWhite} style={{marginLeft: 15, backgroundColor: colors.red[500], color: 'white'}}
backgroundColor={red500}
style={{marginLeft: 15}}
icon={<IconDelete color={fullWhite} />}
onClick={this.onDeleteRequest} onClick={this.onDeleteRequest}
/> >
<IconDelete style={{marginRight: 8}} />
Delete
</Button>
} }
<RaisedButton <Button
type="submit" type="submit"
label="Save" variant="raised"
secondary={true} color="secondary"
icon={<IconSave />}
style={{marginLeft: 15}} style={{marginLeft: 15}}
/> >
<IconSave style={{marginRight: 8}} />
Save
</Button>
</div> </div>
<div> <div>

Loading…
Cancel
Save