blob: 176240f2eda476e06a11958fa6d13eebc6463bc4 (
plain) (
blame)
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
|
import Slider from 'rc-slider';
//import 'rc-slider/assets/index.css';
import * as React from 'react';
import styled from 'styled-components';
import { Text } from 'ts/components/ui/text';
import { colors } from 'ts/style/colors';
const SliderWithTooltip = (Slider as any).createSliderWithTooltip(Slider);
// tslint:disable-next-line:no-unused-expression
export interface FeePercentageSliderProps {
value: number;
onChange: (value: number) => void;
}
export class FeePercentageSlider extends React.Component<FeePercentageSliderProps> {
public render(): React.ReactNode {
return (
<StyledSlider
min={0}
max={0.05}
step={0.0025}
value={this.props.value}
onChange={this.props.onChange}
tipFormatter={this._feePercentageSliderFormatter}
tipProps={{ placement: 'bottom' }}
trackStyle={{
backgroundColor: '#b4b4b4',
}}
railStyle={{
backgroundColor: '#696969',
}}
handleStyle={{
border: 'none',
boxShadow: 'none',
}}
activeDotStyle={{
boxShadow: 'none',
border: 'none',
}}
/>
);
}
private readonly _feePercentageSliderFormatter = (value: number): React.ReactNode => {
return <Text fontColor={colors.black} fontSize="14px" fontWeight={700}>{`${(value * 100).toFixed(2)}%`}</Text>;
};
}
const StyledSlider = styled(SliderWithTooltip)`
.rc-slider-tooltip-inner {
box-shadow: none !important;
background-color: ${colors.white} !important;
border-radius: 4px !important;
padding: 3px 12px !important;
height: auto !important;
position: relative;
top: 7px;
&:after {
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 6px;
bottom: 100%;
left: 100%;
border-bottom-color: ${colors.white};
margin-left: -60%;
}
}
`;
|