-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (39 loc) · 1.02 KB
/
index.js
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
import ReactColorConfigurationModal from '../src/main';
import ReactDOM from 'react-dom';
import React from 'react';
import './assets/style.scss';
class App extends React.Component {
state = {
visible: true,
value: ['#7B0600', '#9E4000', '#916400']
};
_onClick = (e) => {
this.setState({ visible: true });
};
_onModalClick = (e) => {
this.setState({ visible: false });
console.log('on modal click');
};
_onChange = (e) => {
console.log('on change!', e.target);
};
render() {
const { value } = this.state;
return (
<div className="app-container">
<button className="button" onClick={this._onClick}>
ShowModal
</button>
<ReactColorConfigurationModal
modal
colorCfgOptions={{ current: '#7B0600' }}
value={value}
onChange={this._onChange}
onModalClick={this._onModalClick}
visible={this.state.visible}
/>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));