-
Notifications
You must be signed in to change notification settings - Fork 113
/
VariableHeight.js
47 lines (40 loc) · 1.13 KB
/
VariableHeight.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
import React from 'react';
import {Collapse} from '../../src';
export class VariableHeight extends React.PureComponent {
constructor(props) {
super(props);
this.state = {isOpened: false, height: 100};
}
render() {
const {isOpened, height} = this.state;
return (
<div {...this.props}>
<div className="config">
<label className="label">
Opened:
<input
className="input"
type="checkbox"
checked={isOpened}
onChange={({target: {checked}}) => this.setState({isOpened: checked})} />
</label>
<label className="label">
Content height:
<input
className="input"
type="range"
value={height}
step={50}
min={0}
max={500}
onChange={({target: {value}}) => this.setState({height: parseInt(value, 10)})} />
{height}
</label>
</div>
<Collapse isOpened={isOpened}>
<div style={{height}} className="blob" />
</Collapse>
</div>
);
}
}