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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
import React from 'react';
import { PropTypes } from 'prop-types';
import classNames from 'classnames';
import SettingsIcon from '@material-ui/icons/SettingsApplications';
import CloseIcon from '@material-ui/icons/Close';
import { withStyles } from '@material-ui/core/styles';
import {
AppBar,
Grid,
Dialog,
Toolbar,
ListItemText,
ListItem,
List,
ListItemSecondaryAction,
Divider,
IconButton,
Typography,
Button,
Switch,
Slide,
InputLabel,
MenuItem,
FormControl,
Select,
Checkbox,
TextField,
} from '@material-ui/core';
import styles from './settings-jss';
const Transition = React.forwardRef(function Transition(props, ref) { // eslint-disable-line
return <Slide direction="up" ref={ref} {...props} />;
});
class DetailSettings extends React.Component {
state = {
checked: ['switch', 'check2'],
option: '',
};
handleToggle = value => () => {
const { checked } = this.state;
const currentIndex = checked.indexOf(value);
const newChecked = [...checked];
if (currentIndex === -1) {
newChecked.push(value);
} else {
newChecked.splice(currentIndex, 1);
}
this.setState({
checked: newChecked,
});
};
handleChange = name => event => {
this.setState({
[name]: event.target.value,
});
};
handleChangeSelection = event => {
this.setState({ [event.target.name]: event.target.value });
};
render() {
const { classes, open, handleClose } = this.props;
return (
<Dialog
fullScreen
open={open}
onClose={handleClose}
TransitionComponent={Transition}
>
<AppBar className={classes.appBar}>
<Toolbar>
<IconButton color="inherit" onClick={handleClose} aria-label="Close">
<CloseIcon />
</IconButton>
<Typography variant="h6" color="inherit" className={classes.flex}>
Setting
</Typography>
<Button color="inherit" onClick={handleClose}>
done
</Button>
</Toolbar>
</AppBar>
<Grid container justify="center">
<Grid item md={8} xs={12}>
<List>
<ListItem>
<ListItemText primary="Switch input" secondary="Odio ac imperdiet luctus" />
<ListItemSecondaryAction>
<Switch
onChange={this.handleToggle('switch')}
checked={this.state.checked.indexOf('switch') !== -1}
/>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Another switch input" secondary="Lorem Ipsum" />
<ListItemSecondaryAction>
<Switch
onChange={this.handleToggle('switch2')}
checked={this.state.checked.indexOf('switch2') !== -1}
/>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Checkbox input" secondary="Dolor sit amet" />
<ListItemSecondaryAction>
<Checkbox
onChange={this.handleToggle('check')}
checked={this.state.checked.indexOf('check') !== -1}
/>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Another checkbox input" secondary="Donec dignissim" />
<ListItemSecondaryAction>
<Checkbox
onChange={this.handleToggle('check2')}
checked={this.state.checked.indexOf('check2') !== -1}
/>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Selection field" secondary="Nam posuere accumsan porta" />
<ListItemSecondaryAction>
<FormControl className={classes.formControl}>
<InputLabel htmlFor="age-simple">Option</InputLabel>
<Select
value={this.state.option}
onChange={this.handleChangeSelection}
inputProps={{
name: 'option',
id: 'opt-simple',
}}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Option Ten</MenuItem>
<MenuItem value={20}>Option Twenty</MenuItem>
<MenuItem value={30}>Option Thirty</MenuItem>
</Select>
</FormControl>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Input text" secondary="Donec dignissim, odio ac imperdiet luctus" />
<ListItemSecondaryAction>
<TextField
id="name"
label="Name"
className={classes.textField}
value={this.state.name}
onChange={this.handleChange('name')}
margin="normal"
/>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Input text" secondary="Donec dignissim, odio ac imperdiet luctus" />
<ListItemSecondaryAction>
<Button variant="outlined" size="small" color="secondary" className={classes.button}>
Action Button
</Button>
</ListItemSecondaryAction>
</ListItem>
<Divider />
<ListItem>
<ListItemText primary="Input text" secondary="Donec dignissim, odio ac imperdiet luctus" />
<ListItemSecondaryAction>
<Button variant="outlined" size="small" color="secondary">
<SettingsIcon className={classNames(classes.leftIcon, classes.iconSmall)} />
Action Button Icon
</Button>
</ListItemSecondaryAction>
</ListItem>
</List>
</Grid>
</Grid>
</Dialog>
);
}
}
DetailSettings.propTypes = {
classes: PropTypes.object.isRequired,
open: PropTypes.bool.isRequired,
handleClose: PropTypes.func.isRequired,
};
export default withStyles(styles)(DetailSettings);
|