@momo-kits/progress-info 0.167.1-duotest.1 → 0.167.1-rc.2

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.
@@ -40,15 +40,18 @@ const ProgressInfoHorizontal: FC<ProgressInfoProps> = ({
40
40
 
41
41
  const haveMarginRight =
42
42
  ii !== steps.length - 1 && align !== 'center' && align !== 'stretch';
43
+ const marginRight = haveMarginRight ? Spacing.XS : 0;
43
44
 
44
45
  return (
45
46
  <View
46
47
  key={`Step ${ii}`}
47
- style={{
48
- flex: 1,
49
- alignItems,
50
- marginRight: haveMarginRight ? Spacing.XS : 0,
51
- }}>
48
+ style={[
49
+ styles.flex1,
50
+ {
51
+ alignItems,
52
+ marginRight,
53
+ },
54
+ ]}>
52
55
  {renderStepIcon(i, ii, align)}
53
56
  {!!title && showTitle && (
54
57
  <Text
@@ -71,11 +74,13 @@ const ProgressInfoHorizontal: FC<ProgressInfoProps> = ({
71
74
  const renderStepIcon = (
72
75
  i: ProgressInfoItem,
73
76
  ii: number,
74
- align: string = 'center'
77
+ stepAlign: string = 'center'
75
78
  ) => {
76
- const lineLeftHide = (align === 'stretch' && ii === 0) || align === 'left';
79
+ const lineLeftHide =
80
+ (stepAlign === 'stretch' && ii === 0) || stepAlign === 'left';
77
81
  const lineRightHide =
78
- (align === 'stretch' && ii === steps.length - 1) || align === 'right';
82
+ (stepAlign === 'stretch' && ii === steps.length - 1) ||
83
+ stepAlign === 'right';
79
84
 
80
85
  return (
81
86
  <View style={styles.rowStep}>
@@ -117,7 +122,7 @@ const ProgressInfoHorizontal: FC<ProgressInfoProps> = ({
117
122
  };
118
123
 
119
124
  return (
120
- <View style={{flexDirection: 'row'}}>
125
+ <View style={styles.row}>
121
126
  {steps.map((i, ii) => {
122
127
  return renderProgressItem(i, ii);
123
128
  })}
@@ -44,7 +44,7 @@ const ProgressInfoIcon: FC<ProgressInfoItemIcon> = ({
44
44
  if (useNumber) {
45
45
  return (
46
46
  <Text
47
- style={{ position: 'absolute' }}
47
+ style={styles.numberLabel}
48
48
  typography={'header_xs_semibold'}
49
49
  color={Colors.pink_MoMo_Branding}
50
50
  >
@@ -66,7 +66,7 @@ const ProgressInfoIcon: FC<ProgressInfoItemIcon> = ({
66
66
  // render default Icon
67
67
  return (
68
68
  <View
69
- style={[styles.currIcon, { width: contentIconSize, aspectRatio: 1 }]}
69
+ style={[styles.currIcon, { width: contentIconSize }]}
70
70
  />
71
71
  );
72
72
  };
@@ -1,7 +1,7 @@
1
1
  import React, {FC, useContext} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import {ProgressInfoItem, ProgressInfoProps} from './types';
4
- import {ApplicationContext, Colors, Spacing, Text} from '@momo-kits/foundation';
4
+ import {ApplicationContext, Colors, Text} from '@momo-kits/foundation';
5
5
  import ProgressInfoIcon from './ProgressInfoIcon';
6
6
  import styles from './styles';
7
7
 
@@ -21,17 +21,8 @@ const ProgressInfoVertical: FC<ProgressInfoProps> = ({
21
21
  const lineColor = theme.colors.primary + '33';
22
22
 
23
23
  return (
24
- <View
25
- key={`Step ${ii}`}
26
- style={{
27
- flexDirection: 'row',
28
- }}>
29
- <View
30
- style={{
31
- alignItems: 'center',
32
- marginRight: Spacing.M,
33
- minHeight: 48,
34
- }}>
24
+ <View key={`Step ${ii}`} style={styles.row}>
25
+ <View style={styles.stepIconColumn}>
35
26
  <ProgressInfoIcon
36
27
  size={size}
37
28
  backgroundColor={Colors.pink_08}
@@ -44,18 +35,12 @@ const ProgressInfoVertical: FC<ProgressInfoProps> = ({
44
35
  <View style={[styles.lineVertical, {backgroundColor: lineColor}]} />
45
36
  )}
46
37
  </View>
47
- <View style={{flex: 1}}>
48
- <View
49
- style={[
50
- {
51
- flexDirection: 'row',
52
- justifyContent: 'space-between',
53
- },
54
- ]}>
38
+ <View style={styles.flex1}>
39
+ <View style={styles.titleRow}>
55
40
  {showTitle && (
56
41
  <Text
57
42
  numberOfLines={2}
58
- style={{marginRight: Spacing.S, flex: 1}}
43
+ style={styles.verticalTitle}
59
44
  typography={'header_xs_semibold'}>
60
45
  {title}
61
46
  </Text>
@@ -74,7 +59,7 @@ const ProgressInfoVertical: FC<ProgressInfoProps> = ({
74
59
  };
75
60
 
76
61
  return (
77
- <View style={{width: '100%'}}>
62
+ <View style={styles.fullWidth}>
78
63
  {steps.map((i, ii) => {
79
64
  return renderStepItem(i, ii);
80
65
  })}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
- "name": "@momo-kits/progress-info",
3
- "version": "0.167.1-duotest.1",
4
- "private": false,
5
- "main": "index.tsx",
6
- "dependencies": {},
7
- "peerDependencies": {
8
- "@momo-kits/foundation": "latest",
9
- "react": "*",
10
- "react-native": "*"
11
- },
12
- "license": "MoMo",
13
- "publishConfig": {
14
- "registry": "https://registry.npmjs.org/"
15
- }
16
- }
2
+ "name": "@momo-kits/progress-info",
3
+ "version": "0.167.1-rc.2",
4
+ "private": false,
5
+ "main": "index.tsx",
6
+ "dependencies": {},
7
+ "peerDependencies": {
8
+ "@momo-kits/foundation": "latest",
9
+ "react": "*",
10
+ "react-native": "*"
11
+ },
12
+ "license": "MoMo",
13
+ "publishConfig": {
14
+ "registry": "https://registry.npmjs.org/"
15
+ }
16
+ }
package/styles.ts CHANGED
@@ -43,4 +43,29 @@ export default StyleSheet.create({
43
43
  borderRadius: Radius.L,
44
44
  aspectRatio: 1,
45
45
  },
46
+ row: {
47
+ flexDirection: 'row',
48
+ },
49
+ flex1: {
50
+ flex: 1,
51
+ },
52
+ fullWidth: {
53
+ width: '100%',
54
+ },
55
+ numberLabel: {
56
+ position: 'absolute',
57
+ },
58
+ stepIconColumn: {
59
+ alignItems: 'center',
60
+ marginRight: Spacing.M,
61
+ minHeight: 48,
62
+ },
63
+ titleRow: {
64
+ flexDirection: 'row',
65
+ justifyContent: 'space-between',
66
+ },
67
+ verticalTitle: {
68
+ marginRight: Spacing.S,
69
+ flex: 1,
70
+ },
46
71
  });