();
// Add marks
@@ -29,8 +27,8 @@ export default function Steps(props: StepsProps) {
dotSet.add(mark.value);
});
- //Fill marksValue
- marksValueRef.current = Array.from(dotSet);
+ // Set marksValue
+ const uniqueMarksValue = Array.from(dotSet);
// Fill dots
if (dots && step !== null) {
@@ -41,14 +39,17 @@ export default function Steps(props: StepsProps) {
}
}
- return Array.from(dotSet);
+ return {
+ marksValue: uniqueMarksValue,
+ stepDots: Array.from(dotSet),
+ };
}, [min, max, step, dots, marks]);
return (
{stepDots.map((dotValue) => {
// Check whether it is a marks dot
- const isMarksDot = marksValueRef.current.indexOf(dotValue) >= 0;
+ const isMarksDot = marksValue.indexOf(dotValue) >= 0;
return (
Date: Wed, 19 Apr 2023 18:15:02 +0800
Subject: [PATCH 6/8] chore: format
---
src/Steps/Dot.tsx | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/Steps/Dot.tsx b/src/Steps/Dot.tsx
index 9f2f91a10..f3b8f3456 100644
--- a/src/Steps/Dot.tsx
+++ b/src/Steps/Dot.tsx
@@ -34,13 +34,9 @@ export default function Dot(props: DotProps) {
return (
);
From 8dc1f33027de7db417ce331f03f697c6f51f7901 Mon Sep 17 00:00:00 2001
From: cookygg <379360444@qq.com>
Date: Wed, 19 Apr 2023 18:27:03 +0800
Subject: [PATCH 7/8] chore: move className
---
src/Steps/index.tsx | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/Steps/index.tsx b/src/Steps/index.tsx
index 3447124fd..e7b2e6781 100644
--- a/src/Steps/index.tsx
+++ b/src/Steps/index.tsx
@@ -16,9 +16,6 @@ export default function Steps(props: StepsProps) {
const { prefixCls, marks, dots, style, activeStyle } = props;
const { min, max, step } = React.useContext(SliderContext);
- // It defines the className for the marks dots.
- const marksDotClassName = `${prefixCls}-marks-dot`;
-
const { stepDots, marksValue } = React.useMemo(() => {
const dotSet = new Set();
@@ -55,7 +52,7 @@ export default function Steps(props: StepsProps) {
Date: Thu, 20 Apr 2023 16:40:34 +0800
Subject: [PATCH 8/8] feat: marks dot style
---
assets/index.less | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/assets/index.less b/assets/index.less
index 998a6063c..2aeffefbc 100644
--- a/assets/index.less
+++ b/assets/index.less
@@ -131,9 +131,18 @@
border: 2px solid #e9e9e9;
border-radius: 50%;
cursor: pointer;
+
+ &.@{prefixClass}-marks-dot {
+ border-color: #d6d6d6;
+ }
+
&-active {
- border-color: tint(@primary-color, 50%);
+ &,
+ &.@{prefixClass}-marks-dot {
+ border-color: tint(@primary-color, 50%);
+ }
}
+
&-reverse {
margin-right: -4px;
}