blob: d8ef3a745434acff34e3a27e98e2bf77eed62bc3 (
plain)
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
|
import React from 'react';
import { Helmet } from 'react-helmet';
import brand from 'ba-api/brand';
import { withStyles } from '@material-ui/core/styles';
import { SourceReader, PapperBlock } from 'ba-components';
import { ReduxFormDemo } from './demos';
const styles = ({
root: {
flexGrow: 1,
}
});
class ReduxForm extends React.Component {
state = {
valueForm: []
}
showResult(values) {
setTimeout(() => {
this.setState({ valueForm: values });
window.alert(`You submitted:\n\n${this.state.valueForm}`);
}, 500); // simulate server latency
}
render() {
const title = brand.name + ' - Form';
const description = brand.desc;
const docSrc = 'containers/Forms/demos/';
return (
<div>
<Helmet>
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
</Helmet>
<PapperBlock title="Redux Form" desc="This is a simple demonstration of how to connect all the standard material-ui form elements to redux-form.">
<div>
<ReduxFormDemo onSubmit={(values) => this.showResult(values)} />
<SourceReader componentName={docSrc + 'ReduxFormDemo.js'} />
</div>
</PapperBlock>
</div>
);
}
}
export default withStyles(styles)(ReduxForm);
|