-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathdev.js
106 lines (100 loc) · 2.68 KB
/
dev.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
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
import React from 'react';
import ReactDOM from 'react-dom';
import Knob from './Knob';
class Root extends React.Component {
static responsiveWidths = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
state = {
value: 10,
responsiveWidth: Root.responsiveWidths[Math.floor(Math.random() * Root.responsiveWidths.length)],
};
handleChange = (newValue) => {
this.setState({ value: newValue });
};
handleUpdateResponsiveWidth = () => {
this.setState({
responsiveWidth: Root.responsiveWidths[Math.floor(Math.random() * Root.responsiveWidths.length)],
});
}
render() {
return (
<div>
<div>
<h1>Static</h1>
<Knob
value={this.state.value}
onChange={this.handleChange}
step={10}
min={0}
max={500}
angleArc={180}
angleOffset={-90}
height={100}
width={200}
onChangeEnd={(v) => console.log(v)}
/>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
angleArc={180}
height={200}
width={100}
/>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
/>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
/>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
/>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
/>
</div>
<div>
<h2 onClick={this.handleUpdateResponsiveWidth}>Responsive</h2>
<div style={{ width: this.state.responsiveWidth }}>
<Knob
value={this.state.value}
onChange={this.handleChange}
onChangeEnd={(v) => console.log(v)}
step={10}
min={0}
max={500}
width={this.state.responsiveWidth}
/>
</div>
</div>
</div>
);
}
}
ReactDOM.render(
<Root />,
document.getElementById('root')
);