@@ -6,17 +6,21 @@ import SliderContext from '../context';
6
6
export interface DotProps {
7
7
prefixCls : string ;
8
8
value : number ;
9
+ marksValue : number [ ] ;
9
10
style ?: React . CSSProperties | ( ( dotValue : number ) => React . CSSProperties ) ;
10
11
activeStyle ?: React . CSSProperties | ( ( dotValue : number ) => React . CSSProperties ) ;
11
12
}
12
13
13
14
export default function Dot ( props : DotProps ) {
14
- const { prefixCls, value, style, activeStyle } = props ;
15
- const { min, max, direction, included, includedStart, includedEnd } =
16
- React . useContext ( SliderContext ) ;
15
+ const { prefixCls, marksValue, value, style, activeStyle } = props ;
16
+ const { min, max, direction, included, includedStart, includedEnd } = React . useContext (
17
+ SliderContext ,
18
+ ) ;
17
19
18
20
const dotClassName = `${ prefixCls } -dot` ;
21
+ const marksDotClassName = `${ prefixCls } -marks-dot` ;
19
22
const active = included && includedStart <= value && value <= includedEnd ;
23
+ const marksDot = marksValue . indexOf ( value ) >= 0 ;
20
24
21
25
// ============================ Offset ============================
22
26
let mergedStyle = {
@@ -33,9 +37,15 @@ export default function Dot(props: DotProps) {
33
37
34
38
return (
35
39
< span
36
- className = { classNames ( dotClassName , {
37
- [ `${ dotClassName } -active` ] : active ,
38
- } ) }
40
+ className = { classNames (
41
+ dotClassName ,
42
+ {
43
+ [ `${ dotClassName } -active` ] : active ,
44
+ } ,
45
+ {
46
+ [ marksDotClassName ] : marksDot ,
47
+ } ,
48
+ ) }
39
49
style = { mergedStyle }
40
50
/>
41
51
) ;
0 commit comments