@tactics/toddle-styleguide 1.4.6 → 1.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -13,8 +13,8 @@ type ChildListItemProps = {
13
13
  onLongPress: (id: string) => void;
14
14
  onSelect: (id: string) => void;
15
15
  sourceAvatar: ImageSourcePropType | Initials;
16
- textTimeTracker: string;
17
- visualStateTimeTracker: VisualState;
16
+ textTimeTracker?: string;
17
+ visualStateTimeTracker?: VisualState;
18
18
  tags?: string[];
19
19
  };
20
20
  declare const ChildListItem: React.MemoExoticComponent<({ id, name, department, selectable, isSelected, onPressArrow, onPressText, onLongPress, onSelect, sourceAvatar, textTimeTracker, visualStateTimeTracker, tags, }: ChildListItemProps) => React.JSX.Element>;
@@ -25,8 +25,8 @@ type ChildListItemProps = {
25
25
  onLongPress: (id: string) => void;
26
26
  onSelect: (id: string) => void;
27
27
  sourceAvatar: ImageSourcePropType | Initials;
28
- textTimeTracker: string;
29
- visualStateTimeTracker: VisualState;
28
+ textTimeTracker?: string;
29
+ visualStateTimeTracker?: VisualState;
30
30
  tags?: string[];
31
31
  };
32
32
 
@@ -69,6 +69,19 @@ const ChildListItem = React.memo(
69
69
  return isSelected ? context.colors.ui.white : context.colors.ui.black;
70
70
  }, [isSelected]);
71
71
 
72
+ const renderTimeTracker = (textTimeTracker?: string, visualStateTimeTracker?: VisualState) => {
73
+ if (textTimeTracker && visualStateTimeTracker) {
74
+ return <TimeTracker
75
+ text={textTimeTracker}
76
+ visualState={visualStateTimeTracker}
77
+ textColor={textColor}
78
+ />
79
+ } else {
80
+ return <View style={styles.timeTrackerSpacer}></View>
81
+ }
82
+
83
+ }
84
+
72
85
  return (
73
86
  <View style={styles.container}>
74
87
  <Pressable
@@ -83,11 +96,7 @@ const ChildListItem = React.memo(
83
96
  />
84
97
  <View style={styles.pressableText}>
85
98
  <View style={styles.trackerContainer}>
86
- <TimeTracker
87
- text={textTimeTracker}
88
- visualState={visualStateTimeTracker}
89
- textColor={textColor}
90
- />
99
+ {renderTimeTracker(textTimeTracker, visualStateTimeTracker)}
91
100
  </View>
92
101
  <View>
93
102
  <Heading2
@@ -70,8 +70,6 @@ export const ChildListItemPreview = ({}: {}) => {
70
70
  onSelect={addIdToSelected}
71
71
  // sourceAvatar={require('./../../../../assets/components/avatar/baby.png')}
72
72
  sourceAvatar={Initials.for('Zeno', 'Driesen')}
73
- textTimeTracker={'3u45m'}
74
- visualStateTimeTracker={VisualState.SUCCESS}
75
73
  tags={item.tags}
76
74
  />
77
75
  );
@@ -33,4 +33,8 @@ export function Stylesheet(isSelectedItem: any, context: any): {
33
33
  flexDirection: "row";
34
34
  alignItems: "center";
35
35
  };
36
+ timeTrackerSpacer: {
37
+ height: number;
38
+ marginBottom: number;
39
+ };
36
40
  };
@@ -40,4 +40,8 @@ export const Stylesheet = (isSelectedItem, context) =>
40
40
  flexDirection: 'row',
41
41
  alignItems: 'center',
42
42
  },
43
+ timeTrackerSpacer: {
44
+ height: Scale.s,
45
+ marginBottom: Scale.xxs
46
+ }
43
47
  });