@momo-kits/step 0.169.8 → 0.169.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/StepsHorizontal.tsx +2 -2
- package/package.json +1 -1
- package/utils.ts +11 -7
package/StepsHorizontal.tsx
CHANGED
|
@@ -58,7 +58,7 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const handleTimesLayout = (e: LayoutChangeEvent) => {
|
|
62
62
|
const { height } = e.nativeEvent.layout;
|
|
63
63
|
if (height !== timeHeight && height > timeHeight) setTimeHeight(height);
|
|
64
64
|
};
|
|
@@ -91,7 +91,7 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
91
91
|
>
|
|
92
92
|
{!!time && (
|
|
93
93
|
<Text
|
|
94
|
-
onLayout={
|
|
94
|
+
onLayout={handleTimesLayout}
|
|
95
95
|
style={{ textAlign }}
|
|
96
96
|
color={
|
|
97
97
|
disabled ? theme.colors.text.disable : typoStyle.time.color
|
package/package.json
CHANGED
package/utils.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { ApplicationContext, Colors, Typography } from '@momo-kits/foundation';
|
|
|
2
2
|
import { Step } from '@momo-kits/step';
|
|
3
3
|
import { useContext } from 'react';
|
|
4
4
|
|
|
5
|
+
/** Hex alpha (20%) appended to the primary color for a passed connector line. */
|
|
6
|
+
const COMPLETED_LINE_ALPHA = '33';
|
|
7
|
+
|
|
5
8
|
type StepStatus = 'incomplete' | 'current' | 'completed' | 'error' | 'disable';
|
|
6
9
|
type StepTypo = {
|
|
7
10
|
typography: Typography;
|
|
@@ -31,6 +34,7 @@ const checkSizeAndStepType = (
|
|
|
31
34
|
);
|
|
32
35
|
};
|
|
33
36
|
|
|
37
|
+
/** Title typography: semibold for current/error steps, smaller when compact. */
|
|
34
38
|
const getTypoTitle = (
|
|
35
39
|
status: StepStatus,
|
|
36
40
|
size?: 'small' | 'large',
|
|
@@ -110,21 +114,21 @@ export const GetStepColor = (
|
|
|
110
114
|
disabled?: boolean,
|
|
111
115
|
) => {
|
|
112
116
|
const { theme } = useContext(ApplicationContext);
|
|
113
|
-
const
|
|
114
|
-
const
|
|
117
|
+
const defaultLineColor = theme.colors.border.default;
|
|
118
|
+
const completedLineColor = theme.colors.primary + COMPLETED_LINE_ALPHA;
|
|
115
119
|
|
|
116
120
|
let backgroundColor = Colors.black_06;
|
|
117
121
|
let borderColor = theme.colors.border.default;
|
|
118
|
-
let lineColorLeft =
|
|
119
|
-
let lineColorRight =
|
|
122
|
+
let lineColorLeft = defaultLineColor;
|
|
123
|
+
let lineColorRight = defaultLineColor;
|
|
120
124
|
const status = getStatus(activeIndex, currentIndex, error, disabled);
|
|
121
125
|
|
|
122
126
|
if (activeIndex > currentIndex) {
|
|
123
|
-
lineColorLeft =
|
|
124
|
-
lineColorRight =
|
|
127
|
+
lineColorLeft = completedLineColor;
|
|
128
|
+
lineColorRight = completedLineColor;
|
|
125
129
|
}
|
|
126
130
|
if (activeIndex === currentIndex) {
|
|
127
|
-
lineColorLeft =
|
|
131
|
+
lineColorLeft = completedLineColor;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
if (currentIndex === 0) {
|