-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhome-page.tsx
126 lines (115 loc) · 3.87 KB
/
home-page.tsx
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
import * as React from 'react';
import AddIcon from 'material-ui-icons/Add';
import Button from 'material-ui/Button';
import { withStyles } from 'material-ui/styles';
import TextField from 'material-ui/TextField';
import Typography from 'material-ui/Typography';
import { action, observable } from 'mobx';
import { observer } from 'mobx-react';
import { Titlebar } from '../shared/components';
const styles = theme => ({
root: {
height: '100%',
display: 'flex',
flexDirection: 'column'
},
content: {
padding: theme.spacing.unit
},
demoTitle: {
margin: '1.5em 0 0.5em 0'
},
demoContainer: {
backgroundColor: theme.palette.background.contentFrame,
padding: theme.spacing.unit
},
button: {
margin: theme.spacing.unit
},
input: {
margin: theme.spacing.unit
}
});
interface HomePageProps {
// tslint:disable-next-line
classes: any;
}
@observer
class HomePageBase extends React.Component<HomePageProps, {}> {
@observable name = '';
@action
// tslint:disable-next-line
onChange = (event: any) => {
this.name = event.target.value;
};
render() {
const { classes } = this.props;
return (
<div className={classes.root}>
<Titlebar>React MobX MUI TypeScript Seed</Titlebar>
<div className={classes.content}>
<Typography type="title" className={classes.demoTitle}>
Buttons
</Typography>
<div className={classes.demoContainer}>
<Button raised={true} className={classes.button}>
Default
</Button>
<Button
raised={true}
color="primary"
className={classes.button}
>
Primary
</Button>
<Button
raised={true}
color="accent"
className={classes.button}
>
Accent
</Button>
<Button
raised={true}
color="contrast"
className={classes.button}
>
Contrast
</Button>
<Button
raised={true}
color="accent"
disabled={true}
className={classes.button}
>
Disabled
</Button>
<Button
fab={true}
color="primary"
className={classes.button}
>
<AddIcon />
</Button>
</div>
<Typography type="title" className={classes.demoTitle}>
Text Field Using MobX
</Typography>
<div className={classes.demoContainer}>
<TextField
id="name"
label="Name"
className={classes.input}
value={this.name}
onChange={this.onChange}
/>
</div>
<Typography type="body2">
{this.name}
</Typography>
</div>
</div>
);
}
}
export const HomePage = withStyles(styles)(HomePageBase);