@tactics/toddle-styleguide 1.2.8 → 1.3.0
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/App.tsx +11 -0
- package/index.d.ts +2 -1
- package/index.tsx +2 -0
- package/package.json +1 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +18 -18
- package/src/components/atoms/line/line.component.d.ts +12 -0
- package/src/components/atoms/line/line.component.tsx +23 -0
- package/src/components/atoms/line/line.preview.d.ts +1 -0
- package/src/components/atoms/line/line.preview.tsx +54 -0
- package/src/components/atoms/line/line.styles.d.ts +12 -0
- package/src/components/atoms/line/line.styles.js +10 -0
- package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +72 -1
- package/src/components/atoms/quick-message/quick-message.component.d.ts +2 -0
- package/src/components/atoms/quick-message/quick-message.component.tsx +3 -1
- package/src/components/atoms/quick-message/quick-message.preview.tsx +10 -1
- package/src/components/atoms/quick-message/quick-message.styles.d.ts +4 -1
- package/src/components/atoms/quick-message/quick-message.styles.js +4 -2
- package/src/components/atoms/quick-message/quick-message.test.js +38 -6
- package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +38 -78
- package/src/components/atoms/text-input/text-input.component.tsx +6 -9
- package/src/components/atoms/text-input/text-input.preview.tsx +3 -3
- package/src/components/atoms/text-input/text-input.styles.d.ts +9 -25
- package/src/components/atoms/text-input/text-input.styles.js +7 -13
- package/src/components/molecules/day/__snapshots__/day.test.js.snap +24 -24
- package/src/components/molecules/day/day.component.tsx +17 -4
- package/src/components/molecules/day/day.styles.d.ts +33 -42
- package/src/components/molecules/day/day.styles.js +14 -17
- package/src/components/molecules/failed-to-send/failed-bubble.component.d.ts +2 -2
- package/src/components/molecules/failed-to-send/failed-bubble.component.tsx +39 -22
- package/src/components/molecules/password-input/__snapshots__/password-input.test.js.snap +53 -68
- package/src/components/molecules/password-input/password-input.component.tsx +7 -9
- package/src/components/molecules/password-input/password-input.styles.d.ts +8 -7
- package/src/components/molecules/password-input/password-input.styles.js +6 -6
- package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +30 -31
- package/src/components/molecules/search-input/search.component.d.ts +9 -11
- package/src/components/molecules/search-input/search.component.tsx +19 -30
- package/src/components/molecules/search-input/search.preview.tsx +8 -6
- package/src/components/molecules/search-input/search.styles.d.ts +12 -11
- package/src/components/molecules/search-input/search.styles.js +14 -8
- package/src/components/molecules/search-input/search.test.js +3 -1
- package/src/components/molecules/send-bubble/__snapshots__/send-text-bubble.test.js.snap +12 -32
- package/src/components/molecules/send-bubble/send-text-bubble.component.d.ts +4 -4
- package/src/components/molecules/send-bubble/send-text-bubble.component.tsx +36 -25
- package/src/components/molecules/send-bubble/send-text-bubble.styles.d.ts +4 -7
- package/src/components/molecules/send-bubble/send-text-bubble.styles.js +2 -8
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +4 -4
- package/src/components/molecules/timeline/timeline.styles.d.ts +1 -1
- package/src/components/molecules/timeline/timeline.styles.js +2 -2
- package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +2 -1
- package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -1
- package/src/components/molecules/timestamp/timestamp.component.tsx +4 -7
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +165 -10
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -0
- package/src/components/organisms/child-list-item/child-list-item.component.tsx +24 -1
- package/src/components/organisms/child-list-item/child-list-item.preview.tsx +11 -0
- package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +0 -3
- package/src/components/organisms/child-list-item/child-list-item.styles.js +2 -3
- package/src/components/organisms/child-list-item/child-list-item.test.js +9 -4
- package/src/components/organisms/child-list-item/components/child-list-tag.component.d.ts +9 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.component.tsx +28 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.d.ts +13 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.js +16 -0
- package/src/components/organisms/day-select/day-select.preview.tsx +9 -5
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.d.ts +9 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.js +17 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.test.js +21 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.tsx +97 -0
- package/src/components/organisms/journal-entry/components/index.d.ts +2 -0
- package/src/components/organisms/journal-entry/components/index.ts +2 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/__snapshots__/journal-entry-type.test.js.snap +304 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +60 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.js +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.test.js +48 -0
- package/src/components/organisms/journal-entry/journal-entry.component.d.ts +38 -0
- package/src/components/organisms/journal-entry/journal-entry.component.tsx +139 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.d.ts +1 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.tsx +212 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.d.ts +42 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.js +35 -0
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +143 -399
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +5 -7
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.tsx +32 -59
- package/src/components/organisms/my-child-list-item/my-child-list-item.preview.tsx +36 -24
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +15 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.js +16 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +5 -22
- package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +45 -29
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +8 -6
- package/src/components/organisms/text-bubble/text-bubble.component.tsx +14 -12
- package/src/components/organisms/text-bubble/text-bubble.preview.tsx +14 -19
- package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +14 -3
- package/src/components/organisms/text-bubble/text-bubble.styles.js +6 -0
- package/src/components/organisms/text-bubble/text-bubble.test.js +7 -7
- package/src/components/templates/modal/components/fade-panel.component.tsx +1 -1
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +4 -0
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +6 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +14 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +31 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +114 -84
- package/src/utilities/toddle-datetime/types/{duration-like.type.d.ts → duration.type.d.ts} +2 -0
- package/src/utilities/toddle-datetime/types/{duration-like.type.tsx → duration.type.tsx} +3 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +1 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +8 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {useContext} from 'react';
|
|
2
|
+
import {Animated, View, Easing} from 'react-native';
|
|
3
|
+
import {ThemeCtx} from '../../../../../context/theme.context';
|
|
4
|
+
import {Stylesheet} from './entry-type-indicator.styles';
|
|
5
|
+
|
|
6
|
+
interface EntryTypeIndicatorProps {
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
send: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const EntryTypeIndicator = ({
|
|
12
|
+
loading,
|
|
13
|
+
send,
|
|
14
|
+
}: EntryTypeIndicatorProps) => {
|
|
15
|
+
const context = useContext(ThemeCtx);
|
|
16
|
+
const styles = Stylesheet();
|
|
17
|
+
|
|
18
|
+
console.log('ACTIVITY INDICATOR SEND: ', send);
|
|
19
|
+
|
|
20
|
+
const pulseValue = new Animated.Value(1);
|
|
21
|
+
const colorValue = new Animated.Value(1);
|
|
22
|
+
|
|
23
|
+
if (loading || !send) {
|
|
24
|
+
const pulseAnimation = Animated.sequence([
|
|
25
|
+
Animated.timing(pulseValue, {
|
|
26
|
+
toValue: 0.8,
|
|
27
|
+
duration: 800,
|
|
28
|
+
useNativeDriver: false,
|
|
29
|
+
}),
|
|
30
|
+
Animated.timing(pulseValue, {
|
|
31
|
+
toValue: 1,
|
|
32
|
+
duration: 800,
|
|
33
|
+
useNativeDriver: false,
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
const colorAnimation = Animated.sequence([
|
|
38
|
+
Animated.timing(colorValue, {
|
|
39
|
+
toValue: 0,
|
|
40
|
+
duration: 600,
|
|
41
|
+
easing: Easing.linear,
|
|
42
|
+
useNativeDriver: false,
|
|
43
|
+
}),
|
|
44
|
+
Animated.timing(colorValue, {
|
|
45
|
+
toValue: 1,
|
|
46
|
+
duration: 600,
|
|
47
|
+
easing: Easing.linear,
|
|
48
|
+
useNativeDriver: false,
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
const combinedAnimation = Animated.parallel([
|
|
53
|
+
pulseAnimation,
|
|
54
|
+
colorAnimation,
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
const loopedAnimation = Animated.loop(combinedAnimation);
|
|
58
|
+
|
|
59
|
+
loopedAnimation.start();
|
|
60
|
+
} else {
|
|
61
|
+
// Reset the scale and color values when not loading
|
|
62
|
+
pulseValue.setValue(1);
|
|
63
|
+
colorValue.setValue(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const interpolatedLoadingColor = colorValue.interpolate({
|
|
67
|
+
inputRange: [0, 1],
|
|
68
|
+
outputRange: [context.colors.main[5], context.colors.main[9]],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const interpolatedErrorColor = colorValue.interpolate({
|
|
72
|
+
inputRange: [0, 1],
|
|
73
|
+
outputRange: [
|
|
74
|
+
context.colors.ui.error.dark,
|
|
75
|
+
context.colors.ui.error.default,
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<View style={styles.rootContainer}>
|
|
81
|
+
<Animated.View
|
|
82
|
+
testID="indicator"
|
|
83
|
+
style={[
|
|
84
|
+
styles.indicator,
|
|
85
|
+
{
|
|
86
|
+
transform: [{scale: pulseValue}],
|
|
87
|
+
backgroundColor: loading
|
|
88
|
+
? interpolatedLoadingColor
|
|
89
|
+
: !send
|
|
90
|
+
? interpolatedErrorColor
|
|
91
|
+
: interpolatedLoadingColor,
|
|
92
|
+
},
|
|
93
|
+
]}
|
|
94
|
+
/>
|
|
95
|
+
</View>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`JournalEntryType Snapshot renders correctly with prio=false and loading=false 1`] = `
|
|
4
|
+
[
|
|
5
|
+
<View
|
|
6
|
+
style={
|
|
7
|
+
{
|
|
8
|
+
"alignItems": "center",
|
|
9
|
+
"height": 32,
|
|
10
|
+
"justifyContent": "center",
|
|
11
|
+
"width": 32,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
<View
|
|
16
|
+
collapsable={false}
|
|
17
|
+
style={
|
|
18
|
+
{
|
|
19
|
+
"backgroundColor": "rgba(224, 232, 249, 1)",
|
|
20
|
+
"borderRadius": 8,
|
|
21
|
+
"height": 16,
|
|
22
|
+
"transform": [
|
|
23
|
+
{
|
|
24
|
+
"scale": 1,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
"width": 16,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
testID="indicator"
|
|
31
|
+
/>
|
|
32
|
+
</View>,
|
|
33
|
+
<View
|
|
34
|
+
style={
|
|
35
|
+
{
|
|
36
|
+
"flexDirection": "row",
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<View>
|
|
41
|
+
<Text
|
|
42
|
+
style={
|
|
43
|
+
[
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
"fontFamily": "MontserratBold",
|
|
47
|
+
"fontSize": 13,
|
|
48
|
+
"lineHeight": 20.4,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
{
|
|
52
|
+
"color": "#515F6C",
|
|
53
|
+
"textAlign": undefined,
|
|
54
|
+
"width": "100%",
|
|
55
|
+
},
|
|
56
|
+
undefined,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
Type -
|
|
61
|
+
</Text>
|
|
62
|
+
</View>
|
|
63
|
+
<View>
|
|
64
|
+
<Text
|
|
65
|
+
style={
|
|
66
|
+
[
|
|
67
|
+
[
|
|
68
|
+
{
|
|
69
|
+
"fontFamily": "Montserrat",
|
|
70
|
+
"fontSize": 13,
|
|
71
|
+
"lineHeight": 20.4,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
{
|
|
75
|
+
"color": "#515F6C",
|
|
76
|
+
"textAlign": undefined,
|
|
77
|
+
"width": "100%",
|
|
78
|
+
},
|
|
79
|
+
undefined,
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
>
|
|
83
|
+
12h 07m
|
|
84
|
+
</Text>
|
|
85
|
+
</View>
|
|
86
|
+
</View>,
|
|
87
|
+
]
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
exports[`JournalEntryType Snapshot renders correctly with prio=true and loading=false 1`] = `
|
|
91
|
+
[
|
|
92
|
+
<View
|
|
93
|
+
style={
|
|
94
|
+
{
|
|
95
|
+
"alignItems": "center",
|
|
96
|
+
"backgroundColor": "#FFFFFF",
|
|
97
|
+
"borderColor": "#FFFFFF",
|
|
98
|
+
"borderRadius": 50,
|
|
99
|
+
"borderWidth": 4,
|
|
100
|
+
"justifyContent": "center",
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
>
|
|
104
|
+
<RNSVGSvgView
|
|
105
|
+
align="xMidYMid"
|
|
106
|
+
bbHeight="24"
|
|
107
|
+
bbWidth="24"
|
|
108
|
+
fill="none"
|
|
109
|
+
focusable={false}
|
|
110
|
+
height={24}
|
|
111
|
+
meetOrSlice={0}
|
|
112
|
+
minX={0}
|
|
113
|
+
minY={0}
|
|
114
|
+
style={
|
|
115
|
+
[
|
|
116
|
+
{
|
|
117
|
+
"backgroundColor": "transparent",
|
|
118
|
+
"borderWidth": 0,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"flex": 0,
|
|
122
|
+
"height": 24,
|
|
123
|
+
"width": 24,
|
|
124
|
+
},
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
vbHeight={23}
|
|
128
|
+
vbWidth={22}
|
|
129
|
+
width={24}
|
|
130
|
+
>
|
|
131
|
+
<RNSVGGroup
|
|
132
|
+
fill={null}
|
|
133
|
+
propList={
|
|
134
|
+
[
|
|
135
|
+
"fill",
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
<RNSVGPath
|
|
140
|
+
d="M11 7V11.5M11 16H11.0108M20.75 11.5C20.75 17.0919 16.3848 21.625 11 21.625C5.61522 21.625 1.25 17.0919 1.25 11.5C1.25 5.90812 5.61522 1.375 11 1.375C16.3848 1.375 20.75 5.90812 20.75 11.5Z"
|
|
141
|
+
propList={
|
|
142
|
+
[
|
|
143
|
+
"stroke",
|
|
144
|
+
"strokeWidth",
|
|
145
|
+
"strokeLinecap",
|
|
146
|
+
"strokeLinejoin",
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
stroke={
|
|
150
|
+
{
|
|
151
|
+
"payload": 4294618180,
|
|
152
|
+
"type": 0,
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
strokeLinecap={1}
|
|
156
|
+
strokeLinejoin={1}
|
|
157
|
+
strokeWidth="2"
|
|
158
|
+
/>
|
|
159
|
+
</RNSVGGroup>
|
|
160
|
+
</RNSVGSvgView>
|
|
161
|
+
</View>,
|
|
162
|
+
<View
|
|
163
|
+
style={
|
|
164
|
+
{
|
|
165
|
+
"flexDirection": "row",
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
<View>
|
|
170
|
+
<Text
|
|
171
|
+
style={
|
|
172
|
+
[
|
|
173
|
+
[
|
|
174
|
+
{
|
|
175
|
+
"fontFamily": "MontserratBold",
|
|
176
|
+
"fontSize": 13,
|
|
177
|
+
"lineHeight": 20.4,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
{
|
|
181
|
+
"color": "#515F6C",
|
|
182
|
+
"textAlign": undefined,
|
|
183
|
+
"width": "100%",
|
|
184
|
+
},
|
|
185
|
+
undefined,
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
>
|
|
189
|
+
Type -
|
|
190
|
+
</Text>
|
|
191
|
+
</View>
|
|
192
|
+
<View>
|
|
193
|
+
<Text
|
|
194
|
+
style={
|
|
195
|
+
[
|
|
196
|
+
[
|
|
197
|
+
{
|
|
198
|
+
"fontFamily": "Montserrat",
|
|
199
|
+
"fontSize": 13,
|
|
200
|
+
"lineHeight": 20.4,
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
{
|
|
204
|
+
"color": "#515F6C",
|
|
205
|
+
"textAlign": undefined,
|
|
206
|
+
"width": "100%",
|
|
207
|
+
},
|
|
208
|
+
undefined,
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
>
|
|
212
|
+
12h 07m
|
|
213
|
+
</Text>
|
|
214
|
+
</View>
|
|
215
|
+
</View>,
|
|
216
|
+
]
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
exports[`JournalEntryType Snapshot renders correctly with prio=true and loading=true 1`] = `
|
|
220
|
+
[
|
|
221
|
+
<View
|
|
222
|
+
style={
|
|
223
|
+
{
|
|
224
|
+
"alignItems": "center",
|
|
225
|
+
"height": 32,
|
|
226
|
+
"justifyContent": "center",
|
|
227
|
+
"width": 32,
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
>
|
|
231
|
+
<View
|
|
232
|
+
collapsable={false}
|
|
233
|
+
style={
|
|
234
|
+
{
|
|
235
|
+
"backgroundColor": "rgba(224, 232, 249, 1)",
|
|
236
|
+
"borderRadius": 8,
|
|
237
|
+
"height": 16,
|
|
238
|
+
"transform": [
|
|
239
|
+
{
|
|
240
|
+
"scale": 1,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
"width": 16,
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
testID="indicator"
|
|
247
|
+
/>
|
|
248
|
+
</View>,
|
|
249
|
+
<View
|
|
250
|
+
style={
|
|
251
|
+
{
|
|
252
|
+
"flexDirection": "row",
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
>
|
|
256
|
+
<View>
|
|
257
|
+
<Text
|
|
258
|
+
style={
|
|
259
|
+
[
|
|
260
|
+
[
|
|
261
|
+
{
|
|
262
|
+
"fontFamily": "MontserratBold",
|
|
263
|
+
"fontSize": 13,
|
|
264
|
+
"lineHeight": 20.4,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
{
|
|
268
|
+
"color": "#515F6C",
|
|
269
|
+
"textAlign": undefined,
|
|
270
|
+
"width": "100%",
|
|
271
|
+
},
|
|
272
|
+
undefined,
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
>
|
|
276
|
+
Type -
|
|
277
|
+
</Text>
|
|
278
|
+
</View>
|
|
279
|
+
<View>
|
|
280
|
+
<Text
|
|
281
|
+
style={
|
|
282
|
+
[
|
|
283
|
+
[
|
|
284
|
+
{
|
|
285
|
+
"fontFamily": "Montserrat",
|
|
286
|
+
"fontSize": 13,
|
|
287
|
+
"lineHeight": 20.4,
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
{
|
|
291
|
+
"color": "#515F6C",
|
|
292
|
+
"textAlign": undefined,
|
|
293
|
+
"width": "100%",
|
|
294
|
+
},
|
|
295
|
+
undefined,
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
>
|
|
299
|
+
12h 07m
|
|
300
|
+
</Text>
|
|
301
|
+
</View>
|
|
302
|
+
</View>,
|
|
303
|
+
]
|
|
304
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {ToddleDateTime} from '../../../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
2
|
+
interface JournalEntryTypeProps {
|
|
3
|
+
prio: boolean;
|
|
4
|
+
type: string;
|
|
5
|
+
happenedAt: ToddleDateTime;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
send: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const JournalEntryType: ({
|
|
10
|
+
prio,
|
|
11
|
+
type,
|
|
12
|
+
happenedAt,
|
|
13
|
+
loading,
|
|
14
|
+
send,
|
|
15
|
+
}: JournalEntryTypeProps) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {useContext} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {Icon} from '../../../../../icons/index';
|
|
4
|
+
import {ThemeCtx} from '../../../../../context/theme.context';
|
|
5
|
+
import {Stylesheet} from './journal-entry-type.styles';
|
|
6
|
+
import {EntryTypeIndicator} from '../entry-type-indicator/entry-type-indicator';
|
|
7
|
+
import {SmallText} from '../../../../atoms/paragraph-components';
|
|
8
|
+
import {ToddleDateTime} from '../../../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
9
|
+
|
|
10
|
+
interface JournalEntryTypeProps {
|
|
11
|
+
prio: boolean;
|
|
12
|
+
type: string;
|
|
13
|
+
happenedAt: ToddleDateTime;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
send: boolean;
|
|
16
|
+
}
|
|
17
|
+
export const JournalEntryType = ({
|
|
18
|
+
prio,
|
|
19
|
+
type,
|
|
20
|
+
happenedAt,
|
|
21
|
+
loading,
|
|
22
|
+
send,
|
|
23
|
+
}: JournalEntryTypeProps) => {
|
|
24
|
+
const context = useContext(ThemeCtx);
|
|
25
|
+
const styles = Stylesheet(context);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
{loading ? (
|
|
30
|
+
<EntryTypeIndicator loading={loading} send={send} />
|
|
31
|
+
) : send ? (
|
|
32
|
+
prio ? (
|
|
33
|
+
<View style={styles.iconContainer}>
|
|
34
|
+
<Icon
|
|
35
|
+
style={'regular'}
|
|
36
|
+
name={'exclamation-circle'}
|
|
37
|
+
color={context.colors.ui.warning.dark}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
) : (
|
|
41
|
+
<EntryTypeIndicator send={send} />
|
|
42
|
+
)
|
|
43
|
+
) : (
|
|
44
|
+
<EntryTypeIndicator send={send} />
|
|
45
|
+
)}
|
|
46
|
+
<View style={styles.entryTypeTextContainer}>
|
|
47
|
+
<View>
|
|
48
|
+
<SmallText bold={true} textColor={context.colors.ui.darkgrey}>
|
|
49
|
+
{`${type} - `}
|
|
50
|
+
</SmallText>
|
|
51
|
+
</View>
|
|
52
|
+
<View>
|
|
53
|
+
<SmallText textColor={context.colors.ui.darkgrey}>
|
|
54
|
+
{happenedAt.toFormat("HH'h' mm'm'")}
|
|
55
|
+
</SmallText>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function Stylesheet(context: any): {
|
|
2
|
+
iconContainer: {
|
|
3
|
+
backgroundColor: any;
|
|
4
|
+
borderRadius: number;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderColor: any;
|
|
7
|
+
justifyContent: 'center';
|
|
8
|
+
alignItems: 'center';
|
|
9
|
+
};
|
|
10
|
+
entryTypeTextContainer: {
|
|
11
|
+
flexDirection: 'row';
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const Stylesheet = (context) =>
|
|
4
|
+
StyleSheet.create({
|
|
5
|
+
iconContainer: {
|
|
6
|
+
backgroundColor: context.colors.ui.white,
|
|
7
|
+
borderRadius: 50,
|
|
8
|
+
borderWidth: 4,
|
|
9
|
+
borderColor: context.colors.ui.white,
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
},
|
|
13
|
+
entryTypeTextContainer: {
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import {JournalEntryType} from './journal-entry-type.component';
|
|
4
|
+
import {ToddleDateTime} from '../../../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
5
|
+
|
|
6
|
+
describe('JournalEntryType Snapshot', () => {
|
|
7
|
+
it('renders correctly with prio=false and loading=false', () => {
|
|
8
|
+
const tree = renderer
|
|
9
|
+
.create(
|
|
10
|
+
<JournalEntryType
|
|
11
|
+
prio={false}
|
|
12
|
+
type="Type"
|
|
13
|
+
happenedAt={ToddleDateTime.now()}
|
|
14
|
+
loading={false}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
.toJSON();
|
|
18
|
+
expect(tree).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders correctly with prio=true and loading=false', () => {
|
|
22
|
+
const tree = renderer
|
|
23
|
+
.create(
|
|
24
|
+
<JournalEntryType
|
|
25
|
+
prio={true}
|
|
26
|
+
type="Type"
|
|
27
|
+
happenedAt={ToddleDateTime.now()}
|
|
28
|
+
loading={false}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
.toJSON();
|
|
32
|
+
expect(tree).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders correctly with prio=true and loading=true', () => {
|
|
36
|
+
const tree = renderer
|
|
37
|
+
.create(
|
|
38
|
+
<JournalEntryType
|
|
39
|
+
prio={true}
|
|
40
|
+
type="Type"
|
|
41
|
+
happenedAt={ToddleDateTime.now()}
|
|
42
|
+
loading={true}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
.toJSON();
|
|
46
|
+
expect(tree).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
2
|
+
import {VisualState} from '../../../types/visual-state.enum';
|
|
3
|
+
import {BubbleAlignment} from '../../../types/bubble-alignment.enum';
|
|
4
|
+
interface JournalEntryProps {
|
|
5
|
+
id: string;
|
|
6
|
+
prio: boolean;
|
|
7
|
+
happenedAt: ToddleDateTime;
|
|
8
|
+
type: string;
|
|
9
|
+
text: string;
|
|
10
|
+
visualState: VisualState;
|
|
11
|
+
bubbleAlignment: BubbleAlignment;
|
|
12
|
+
createdAt?: ToddleDateTime;
|
|
13
|
+
timestampLabel?: string;
|
|
14
|
+
sendOrReceived: boolean;
|
|
15
|
+
onFail?: (id: string) => void;
|
|
16
|
+
onEdit?: (id: string) => void;
|
|
17
|
+
onDelete?: (id: string) => void;
|
|
18
|
+
afterAnimationComplete?: () => void;
|
|
19
|
+
loadingNewEntry?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const JournalEntry: ({
|
|
22
|
+
id,
|
|
23
|
+
prio,
|
|
24
|
+
happenedAt,
|
|
25
|
+
type,
|
|
26
|
+
text,
|
|
27
|
+
visualState,
|
|
28
|
+
bubbleAlignment,
|
|
29
|
+
createdAt,
|
|
30
|
+
timestampLabel,
|
|
31
|
+
sendOrReceived,
|
|
32
|
+
onFail,
|
|
33
|
+
onEdit,
|
|
34
|
+
onDelete,
|
|
35
|
+
afterAnimationComplete,
|
|
36
|
+
loadingNewEntry,
|
|
37
|
+
}: JournalEntryProps) => JSX.Element;
|
|
38
|
+
export {};
|