-
-
Notifications
You must be signed in to change notification settings - Fork 778
Expand file tree
/
Copy pathmultiple.tsx
More file actions
49 lines (44 loc) · 1.14 KB
/
multiple.tsx
File metadata and controls
49 lines (44 loc) · 1.14 KB
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
/* eslint react/no-multi-comp: 0, no-console: 0 */
import Slider from 'rc-slider';
import React from 'react';
import '../../assets/index.less';
const style: React.CSSProperties = {
width: 400,
margin: 50,
};
function log(value) {
console.log(value);
}
const NodeWrapper = ({ children }: { children: React.ReactElement }) => {
return <div>{React.cloneElement(children, {}, <div>TOOLTIP</div>)}</div>;
};
export default () => {
const [value, setValue] = React.useState([0, 50, 80]);
return (
<div>
<div style={style}>
<Slider
range
// defaultValue={[0, 10, 30]}
// onChange={log}
min={0}
max={100}
value={value}
onChange={(nextValue) => {
// console.log('>>>', nextValue);
setValue(nextValue as any);
}}
activeHandleRender={(node) => <NodeWrapper>{node}</NodeWrapper>}
styles={{
tracks: {
background: `linear-gradient(to right, blue, red)`,
},
track: {
background: 'transparent',
},
}}
/>
</div>
</div>
);
};