@tactics/toddle-styleguide 1.2.0 → 1.2.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.
- package/App.tsx +4 -6
- package/package.json +26 -26
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +18 -18
- package/src/components/atoms/footer/footer.preview.tsx +0 -3
- package/src/components/atoms/footer/footer.styles.js +2 -1
- package/src/components/molecules/avatar/avatar.component.d.ts +2 -1
- package/src/components/molecules/avatar/avatar.component.tsx +26 -3
- package/src/components/molecules/filter-range/__snapshots__/filter-range.test.js.snap +1 -1
- package/src/components/molecules/pill/pill.component.tsx +1 -1
- package/src/components/molecules/quick-filter/quick-filter.component.tsx +4 -2
- package/src/components/molecules/quick-filter/quick-filter.preview.tsx +1 -1
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -1
- package/src/components/organisms/child-list-item/child-list-item.component.tsx +21 -3
- package/src/components/organisms/child-list-item/child-list-item.preview.tsx +6 -1
- package/src/utilities/{text-color-handler/text-color-handler.d.ts → color-handler/color-handler.d.ts} +1 -1
- package/src/utilities/color-handler/color-handler.ts +36 -0
- package/src/utilities/text-color-handler/text-color-handler.tsx +0 -26
package/App.tsx
CHANGED
|
@@ -408,16 +408,14 @@ function App() {
|
|
|
408
408
|
<Stack.Screen name="language-button">
|
|
409
409
|
{() => <LanguageButtonPreview />}
|
|
410
410
|
</Stack.Screen>
|
|
411
|
-
<Stack.Screen name="modal"
|
|
412
|
-
|
|
413
|
-
</Stack.Screen>
|
|
414
|
-
<Stack.Screen name="wave" options={{headerShown: false}}>
|
|
411
|
+
<Stack.Screen name="modal">{() => <ModalPreview />}</Stack.Screen>
|
|
412
|
+
<Stack.Screen name="wave">
|
|
415
413
|
{() => <WaveBackgroundPreview />}
|
|
416
414
|
</Stack.Screen>
|
|
417
|
-
<Stack.Screen name="loading-indicator"
|
|
415
|
+
<Stack.Screen name="loading-indicator">
|
|
418
416
|
{() => <LoadingIndicatorPreview />}
|
|
419
417
|
</Stack.Screen>
|
|
420
|
-
<Stack.Screen name="toddle-datetime"
|
|
418
|
+
<Stack.Screen name="toddle-datetime">
|
|
421
419
|
{() => <ToddleDateTimePreview />}
|
|
422
420
|
</Stack.Screen>
|
|
423
421
|
<Stack.Screen name="background-gradient">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tactics/toddle-styleguide",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"main": "index.tsx",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"prepublish": "tsc",
|
|
@@ -17,33 +17,33 @@
|
|
|
17
17
|
"packageManager": "yarn@3.3.1",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@callstack/react-theme-provider": "^3.0.8",
|
|
20
|
-
"@expo/config-plugins": "~6.0.
|
|
21
|
-
"@expo/webpack-config": "^18.0
|
|
22
|
-
"@miblanchard/react-native-slider": "^2.1
|
|
20
|
+
"@expo/config-plugins": "~6.0.2",
|
|
21
|
+
"@expo/webpack-config": "^18.1.0",
|
|
22
|
+
"@miblanchard/react-native-slider": "^2.3.1",
|
|
23
23
|
"@react-native-picker/picker": "2.4.8",
|
|
24
|
-
"@react-navigation/bottom-tabs": "^6.
|
|
25
|
-
"@react-navigation/drawer": "^6.
|
|
26
|
-
"@react-navigation/native": "^6.
|
|
27
|
-
"@react-navigation/native-stack": "^6.9.
|
|
28
|
-
"@react-navigation/stack": "^6.3.
|
|
24
|
+
"@react-navigation/bottom-tabs": "^6.5.8",
|
|
25
|
+
"@react-navigation/drawer": "^6.6.3",
|
|
26
|
+
"@react-navigation/native": "^6.1.7",
|
|
27
|
+
"@react-navigation/native-stack": "^6.9.13",
|
|
28
|
+
"@react-navigation/stack": "^6.3.17",
|
|
29
29
|
"@tactics/kinderopvang-branding": "1.0.3",
|
|
30
|
-
"@testing-library/react-native": "^
|
|
31
|
-
"@types/luxon": "^3.
|
|
30
|
+
"@testing-library/react-native": "^12.1.2",
|
|
31
|
+
"@types/luxon": "^3.3.0",
|
|
32
32
|
"@types/xdate": "^0.8.32",
|
|
33
|
-
"expo": "^48.0.
|
|
33
|
+
"expo": "^48.0.19",
|
|
34
34
|
"expo-font": "~11.1.1",
|
|
35
35
|
"expo-linear-gradient": "~12.1.2",
|
|
36
36
|
"expo-status-bar": "~1.4.4",
|
|
37
37
|
"intl": "^1.2.5",
|
|
38
|
-
"jsc-android": "^
|
|
39
|
-
"lottie-ios": "
|
|
38
|
+
"jsc-android": "^250231.0.0",
|
|
39
|
+
"lottie-ios": "4.2.0",
|
|
40
40
|
"lottie-react-native": "5.1.4",
|
|
41
41
|
"luxon": "^3.3.0",
|
|
42
42
|
"react": "18.2.0",
|
|
43
43
|
"react-dom": "18.2.0",
|
|
44
|
-
"react-native": "0.71.
|
|
44
|
+
"react-native": "0.71.8",
|
|
45
45
|
"react-native-calendar-strip": "^2.2.6",
|
|
46
|
-
"react-native-calendars": "^1.
|
|
46
|
+
"react-native-calendars": "^1.1299.0",
|
|
47
47
|
"react-native-gesture-handler": "~2.9.0",
|
|
48
48
|
"react-native-picker-select": "^8.0.4",
|
|
49
49
|
"react-native-reanimated": "~2.14.4",
|
|
@@ -52,22 +52,22 @@
|
|
|
52
52
|
"react-native-svg": "13.4.0",
|
|
53
53
|
"react-native-swipe-gestures": "^1.0.5",
|
|
54
54
|
"react-native-swiper": "^1.6.0",
|
|
55
|
-
"react-native-web": "~0.18.
|
|
55
|
+
"react-native-web": "~0.18.10",
|
|
56
56
|
"react-test-renderer": "^18.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "^7.
|
|
60
|
-
"@babel/preset-typescript": "^7.
|
|
61
|
-
"@types/jest": "^29.2
|
|
62
|
-
"@types/luxon": "^3.
|
|
63
|
-
"@types/node": "^
|
|
59
|
+
"@babel/core": "^7.22.5",
|
|
60
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
61
|
+
"@types/jest": "^29.5.2",
|
|
62
|
+
"@types/luxon": "^3.3.0",
|
|
63
|
+
"@types/node": "^20.3.1",
|
|
64
64
|
"@types/react": "~18.0.27",
|
|
65
65
|
"@types/react-dom": "~18.0.10",
|
|
66
66
|
"@types/react-test-renderer": "^18.0.0",
|
|
67
|
-
"jest": "^29.
|
|
68
|
-
"jest-expo": "^
|
|
69
|
-
"prettier": "2.
|
|
70
|
-
"ts-jest": "^29.0
|
|
67
|
+
"jest": "^29.5.0",
|
|
68
|
+
"jest-expo": "^48.0.2",
|
|
69
|
+
"prettier": "2.8.8",
|
|
70
|
+
"ts-jest": "^29.1.0",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
72
|
"typescript": "^4.9.4"
|
|
73
73
|
}
|
|
@@ -1065,7 +1065,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1065
1065
|
}
|
|
1066
1066
|
>
|
|
1067
1067
|
<View
|
|
1068
|
-
accessibilityLabel="
|
|
1068
|
+
accessibilityLabel=" Maandag 3 April 2023 "
|
|
1069
1069
|
accessibilityRole="button"
|
|
1070
1070
|
accessibilityState={
|
|
1071
1071
|
{
|
|
@@ -1097,10 +1097,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1097
1097
|
style={
|
|
1098
1098
|
{
|
|
1099
1099
|
"alignItems": "center",
|
|
1100
|
-
"borderColor": "#7B93DB",
|
|
1101
|
-
"borderRadius": 21,
|
|
1102
|
-
"borderStyle": "solid",
|
|
1103
|
-
"borderWidth": 1,
|
|
1104
1100
|
"height": 42,
|
|
1105
1101
|
"justifyContent": "center",
|
|
1106
1102
|
"opacity": 1,
|
|
@@ -1120,9 +1116,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1120
1116
|
"lineHeight": 22.4,
|
|
1121
1117
|
"marginTop": 4,
|
|
1122
1118
|
},
|
|
1123
|
-
{
|
|
1124
|
-
"color": "#7B93DB",
|
|
1125
|
-
},
|
|
1126
1119
|
]
|
|
1127
1120
|
}
|
|
1128
1121
|
>
|
|
@@ -1153,7 +1146,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1153
1146
|
}
|
|
1154
1147
|
>
|
|
1155
1148
|
<View
|
|
1156
|
-
accessibilityLabel=" Dinsdag 4 April 2023 "
|
|
1149
|
+
accessibilityLabel="today Dinsdag 4 April 2023 "
|
|
1157
1150
|
accessibilityRole="button"
|
|
1158
1151
|
accessibilityState={
|
|
1159
1152
|
{
|
|
@@ -1185,6 +1178,10 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1185
1178
|
style={
|
|
1186
1179
|
{
|
|
1187
1180
|
"alignItems": "center",
|
|
1181
|
+
"borderColor": "#7B93DB",
|
|
1182
|
+
"borderRadius": 21,
|
|
1183
|
+
"borderStyle": "solid",
|
|
1184
|
+
"borderWidth": 1,
|
|
1188
1185
|
"height": 42,
|
|
1189
1186
|
"justifyContent": "center",
|
|
1190
1187
|
"opacity": 1,
|
|
@@ -1204,6 +1201,9 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1204
1201
|
"lineHeight": 22.4,
|
|
1205
1202
|
"marginTop": 4,
|
|
1206
1203
|
},
|
|
1204
|
+
{
|
|
1205
|
+
"color": "#7B93DB",
|
|
1206
|
+
},
|
|
1207
1207
|
]
|
|
1208
1208
|
}
|
|
1209
1209
|
>
|
|
@@ -4436,8 +4436,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4436
4436
|
}
|
|
4437
4437
|
>
|
|
4438
4438
|
<View
|
|
4439
|
-
accessibilityLabel="
|
|
4440
|
-
accessibilityRole="button"
|
|
4439
|
+
accessibilityLabel=" Maandag 3 April 2023 "
|
|
4441
4440
|
accessibilityState={
|
|
4442
4441
|
{
|
|
4443
4442
|
"busy": undefined,
|
|
@@ -4468,10 +4467,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4468
4467
|
style={
|
|
4469
4468
|
{
|
|
4470
4469
|
"alignItems": "center",
|
|
4471
|
-
"borderColor": "#7B93DB",
|
|
4472
|
-
"borderRadius": 21,
|
|
4473
|
-
"borderStyle": "solid",
|
|
4474
|
-
"borderWidth": 1,
|
|
4475
4470
|
"height": 42,
|
|
4476
4471
|
"justifyContent": "center",
|
|
4477
4472
|
"opacity": 1,
|
|
@@ -4492,7 +4487,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4492
4487
|
"marginTop": 4,
|
|
4493
4488
|
},
|
|
4494
4489
|
{
|
|
4495
|
-
"color": "#
|
|
4490
|
+
"color": "#9AA5B1",
|
|
4496
4491
|
},
|
|
4497
4492
|
]
|
|
4498
4493
|
}
|
|
@@ -4524,7 +4519,8 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4524
4519
|
}
|
|
4525
4520
|
>
|
|
4526
4521
|
<View
|
|
4527
|
-
accessibilityLabel=" Dinsdag 4 April 2023 "
|
|
4522
|
+
accessibilityLabel="today Dinsdag 4 April 2023 "
|
|
4523
|
+
accessibilityRole="button"
|
|
4528
4524
|
accessibilityState={
|
|
4529
4525
|
{
|
|
4530
4526
|
"busy": undefined,
|
|
@@ -4555,6 +4551,10 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4555
4551
|
style={
|
|
4556
4552
|
{
|
|
4557
4553
|
"alignItems": "center",
|
|
4554
|
+
"borderColor": "#7B93DB",
|
|
4555
|
+
"borderRadius": 21,
|
|
4556
|
+
"borderStyle": "solid",
|
|
4557
|
+
"borderWidth": 1,
|
|
4558
4558
|
"height": 42,
|
|
4559
4559
|
"justifyContent": "center",
|
|
4560
4560
|
"opacity": 1,
|
|
@@ -4575,7 +4575,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4575
4575
|
"marginTop": 4,
|
|
4576
4576
|
},
|
|
4577
4577
|
{
|
|
4578
|
-
"color": "#
|
|
4578
|
+
"color": "#7B93DB",
|
|
4579
4579
|
},
|
|
4580
4580
|
]
|
|
4581
4581
|
}
|
|
@@ -6,8 +6,9 @@ export const Stylesheet = (context) =>
|
|
|
6
6
|
StyleSheet.create({
|
|
7
7
|
container: {
|
|
8
8
|
flexDirection: 'row',
|
|
9
|
-
alignItems: 'center',
|
|
9
|
+
alignItems: Platform.OS === 'android' ? 'center' : 'flex-start',
|
|
10
10
|
justifyContent: 'center',
|
|
11
|
+
paddingTop: Platform.OS === 'android' ? 0 : Scale.m,
|
|
11
12
|
backgroundColor: context.colors.ui.xlightgrey,
|
|
12
13
|
borderTopColor: context.colors.ui.lightgrey,
|
|
13
14
|
borderStyle: 'solid',
|
|
@@ -6,6 +6,7 @@ type AvatarProps = {
|
|
|
6
6
|
size: Size;
|
|
7
7
|
isBlocked?: boolean;
|
|
8
8
|
isActive?: boolean;
|
|
9
|
+
isLoading?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const Avatar: ({ source, size, isBlocked, isActive }: AvatarProps) => JSX.Element;
|
|
11
|
+
declare const Avatar: ({ source, size, isBlocked, isActive, isLoading, }: AvatarProps) => JSX.Element;
|
|
11
12
|
export { Avatar as Avatar };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {useContext} from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ActivityIndicator,
|
|
6
|
+
Image,
|
|
7
|
+
ImageSourcePropType,
|
|
8
|
+
ImageStyle,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
5
11
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
6
12
|
import {Stylesheet} from './avatar.styles';
|
|
7
13
|
import {Size} from '../../../types/size.enum';
|
|
@@ -14,9 +20,16 @@ type AvatarProps = {
|
|
|
14
20
|
size: Size;
|
|
15
21
|
isBlocked?: boolean;
|
|
16
22
|
isActive?: boolean;
|
|
23
|
+
isLoading?: boolean;
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
const Avatar = ({
|
|
26
|
+
const Avatar = ({
|
|
27
|
+
source,
|
|
28
|
+
size,
|
|
29
|
+
isBlocked,
|
|
30
|
+
isActive = true,
|
|
31
|
+
isLoading,
|
|
32
|
+
}: AvatarProps) => {
|
|
20
33
|
const Context = useContext(ThemeCtx);
|
|
21
34
|
const styles = Stylesheet(Context, size, isBlocked, isActive);
|
|
22
35
|
|
|
@@ -56,7 +69,17 @@ const Avatar = ({source, size, isBlocked, isActive = true}: AvatarProps) => {
|
|
|
56
69
|
};
|
|
57
70
|
|
|
58
71
|
return source instanceof Initials ? (
|
|
59
|
-
<View style={styles.container}>
|
|
72
|
+
<View style={styles.container}>
|
|
73
|
+
{isLoading ? (
|
|
74
|
+
<ActivityIndicator size={'small'} color={Context.colors.ui.white} />
|
|
75
|
+
) : (
|
|
76
|
+
renderText(size)
|
|
77
|
+
)}
|
|
78
|
+
</View>
|
|
79
|
+
) : isLoading ? (
|
|
80
|
+
<View style={styles.container}>
|
|
81
|
+
<ActivityIndicator size={'small'} color={Context.colors.ui.white} />
|
|
82
|
+
</View>
|
|
60
83
|
) : (
|
|
61
84
|
<View style={styles.container}>
|
|
62
85
|
{!isBlocked ? <MainGradient isActive={isActive} /> : null}
|
|
@@ -13,7 +13,6 @@ exports[`Filter range test renders a filter range slider 1`] = `
|
|
|
13
13
|
animationType="timing"
|
|
14
14
|
onLayout={[Function]}
|
|
15
15
|
onValueChange={[Function]}
|
|
16
|
-
step={1}
|
|
17
16
|
style={
|
|
18
17
|
[
|
|
19
18
|
{
|
|
@@ -52,6 +51,7 @@ exports[`Filter range test renders a filter range slider 1`] = `
|
|
|
52
51
|
"borderRadius": 50,
|
|
53
52
|
"height": 8,
|
|
54
53
|
},
|
|
54
|
+
undefined,
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
/>
|
|
@@ -6,7 +6,7 @@ import {ThemeCtx} from '../../../context/theme.context';
|
|
|
6
6
|
import {Stylesheet} from './pill.styles';
|
|
7
7
|
import {VisualState} from '../../../types/visual-state.enum';
|
|
8
8
|
import {TinyText} from '../../atoms/paragraph-components';
|
|
9
|
-
import {TextColorHandler} from '../../../utilities/
|
|
9
|
+
import {TextColorHandler} from '../../../utilities/color-handler/color-handler';
|
|
10
10
|
|
|
11
11
|
type PillProps = {
|
|
12
12
|
visualState: VisualState;
|
|
@@ -6,7 +6,7 @@ import {ThemeCtx} from '../../../context/theme.context';
|
|
|
6
6
|
import {VisualState} from '../../../types/visual-state.enum';
|
|
7
7
|
import {Stylesheet} from './quick-filter.styles';
|
|
8
8
|
import {Paragraph} from '../../atoms/paragraph-components';
|
|
9
|
-
import {TextColorHandler} from '../../../utilities/
|
|
9
|
+
import {TextColorHandler} from '../../../utilities/color-handler/color-handler';
|
|
10
10
|
|
|
11
11
|
type QuickFilterProps = {
|
|
12
12
|
id: string;
|
|
@@ -31,7 +31,9 @@ const QuickFilter = ({
|
|
|
31
31
|
return (
|
|
32
32
|
<Pressable onPress={() => onSelect(id)} style={styles.container}>
|
|
33
33
|
{isLoading ? (
|
|
34
|
-
<ActivityIndicator
|
|
34
|
+
<ActivityIndicator
|
|
35
|
+
color={TextColorHandler(visualState, isSelected, isLoading)}
|
|
36
|
+
/>
|
|
35
37
|
) : (
|
|
36
38
|
<Paragraph
|
|
37
39
|
bold={true}
|
|
@@ -10,10 +10,11 @@ type ChildListItemProps = {
|
|
|
10
10
|
isSelected: boolean;
|
|
11
11
|
onPressArrow: (id: string) => void;
|
|
12
12
|
onPressText: (id: string) => void;
|
|
13
|
+
onLongPress: (id: string) => void;
|
|
13
14
|
onSelect: (id: string) => void;
|
|
14
15
|
sourceAvatar: ImageSourcePropType | Initials;
|
|
15
16
|
textTimeTracker: string;
|
|
16
17
|
visualStateTimeTracker: VisualState;
|
|
17
18
|
};
|
|
18
|
-
declare const ChildListItem: React.MemoExoticComponent<({ id, name, department, selectable, isSelected, onPressArrow, onPressText, onSelect, sourceAvatar, textTimeTracker, visualStateTimeTracker, }: ChildListItemProps) => JSX.Element>;
|
|
19
|
+
declare const ChildListItem: React.MemoExoticComponent<({ id, name, department, selectable, isSelected, onPressArrow, onPressText, onLongPress, onSelect, sourceAvatar, textTimeTracker, visualStateTimeTracker, }: ChildListItemProps) => JSX.Element>;
|
|
19
20
|
export { ChildListItem as ChildListItem };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {useCallback, useContext, useMemo} from 'react';
|
|
2
|
+
import {useCallback, useContext, useMemo, useState} from 'react';
|
|
3
3
|
|
|
4
4
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
5
|
import {ImageSourcePropType, Pressable, View} from 'react-native';
|
|
@@ -21,6 +21,7 @@ type ChildListItemProps = {
|
|
|
21
21
|
isSelected: boolean;
|
|
22
22
|
onPressArrow: (id: string) => void;
|
|
23
23
|
onPressText: (id: string) => void;
|
|
24
|
+
onLongPress: (id: string) => void;
|
|
24
25
|
onSelect: (id: string) => void;
|
|
25
26
|
sourceAvatar: ImageSourcePropType | Initials;
|
|
26
27
|
textTimeTracker: string;
|
|
@@ -36,6 +37,7 @@ const ChildListItem = React.memo(
|
|
|
36
37
|
isSelected,
|
|
37
38
|
onPressArrow,
|
|
38
39
|
onPressText,
|
|
40
|
+
onLongPress,
|
|
39
41
|
onSelect,
|
|
40
42
|
sourceAvatar,
|
|
41
43
|
textTimeTracker,
|
|
@@ -44,6 +46,8 @@ const ChildListItem = React.memo(
|
|
|
44
46
|
const context = useContext(ThemeCtx);
|
|
45
47
|
const styles = Stylesheet(isSelected, context);
|
|
46
48
|
|
|
49
|
+
const [longPressExecuting, setLongPressExecuting] = useState(false);
|
|
50
|
+
|
|
47
51
|
const onPressSelectable = useCallback(() => {
|
|
48
52
|
selectable ? onSelect(id) : onPressText(id);
|
|
49
53
|
}, [id, onPressText, onSelect, selectable]);
|
|
@@ -52,14 +56,28 @@ const ChildListItem = React.memo(
|
|
|
52
56
|
onPressArrow(id);
|
|
53
57
|
}, [id, onPressArrow]);
|
|
54
58
|
|
|
59
|
+
const onLongPressCallback = useCallback(() => {
|
|
60
|
+
setLongPressExecuting(true);
|
|
61
|
+
onLongPress(id);
|
|
62
|
+
setLongPressExecuting(false);
|
|
63
|
+
}, [id, onLongPress]);
|
|
64
|
+
|
|
55
65
|
const textColor = useMemo(() => {
|
|
56
66
|
return isSelected ? context.colors.ui.white : context.colors.ui.black;
|
|
57
67
|
}, [isSelected]);
|
|
58
68
|
|
|
59
69
|
return (
|
|
60
70
|
<View style={styles.container}>
|
|
61
|
-
<Pressable
|
|
62
|
-
|
|
71
|
+
<Pressable
|
|
72
|
+
onPress={onPressSelectable}
|
|
73
|
+
style={styles.innerContainer}
|
|
74
|
+
onLongPress={onLongPressCallback}
|
|
75
|
+
>
|
|
76
|
+
<Avatar
|
|
77
|
+
source={sourceAvatar}
|
|
78
|
+
size={Size.MEDIUM}
|
|
79
|
+
isLoading={longPressExecuting}
|
|
80
|
+
/>
|
|
63
81
|
<View style={styles.pressableText}>
|
|
64
82
|
<View style={styles.trackerContainer}>
|
|
65
83
|
<TimeTracker
|
|
@@ -4,6 +4,7 @@ import {FlatList, View} from 'react-native';
|
|
|
4
4
|
import {VisualState} from '../../../types/visual-state.enum';
|
|
5
5
|
import {PressableIcon} from '../../molecules/pressable-icon/pressable-icon.component';
|
|
6
6
|
import {Icon} from '../../../icons/index';
|
|
7
|
+
import {Initials} from '../../../models/initials.model';
|
|
7
8
|
|
|
8
9
|
interface IData {
|
|
9
10
|
id: string;
|
|
@@ -44,6 +45,8 @@ export const ChildListItemPreview = ({}: {}) => {
|
|
|
44
45
|
return selectedIDs.includes(id);
|
|
45
46
|
};
|
|
46
47
|
|
|
48
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
49
|
+
|
|
47
50
|
const renderChildList = ({item}: any) => {
|
|
48
51
|
return (
|
|
49
52
|
<ChildListItem
|
|
@@ -54,8 +57,10 @@ export const ChildListItemPreview = ({}: {}) => {
|
|
|
54
57
|
isSelected={isIdSelected(item.id)}
|
|
55
58
|
onPressArrow={(id) => console.log(id + ' pressed')}
|
|
56
59
|
onPressText={(id) => console.log('We will do something with id ' + id)}
|
|
60
|
+
onLongPress={(id) => console.log('Do something with id ' + id)}
|
|
57
61
|
onSelect={addIdToSelected}
|
|
58
|
-
sourceAvatar={require('./../../../../assets/components/avatar/baby.png')}
|
|
62
|
+
// sourceAvatar={require('./../../../../assets/components/avatar/baby.png')}
|
|
63
|
+
sourceAvatar={Initials.for('Zeno', 'Driesen')}
|
|
59
64
|
textTimeTracker={'3u45m'}
|
|
60
65
|
visualStateTimeTracker={VisualState.SUCCESS}
|
|
61
66
|
/>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { VisualState } from '../../types/visual-state.enum';
|
|
2
|
-
export declare const TextColorHandler: (visualState: VisualState, selected?: boolean) => string;
|
|
2
|
+
export declare const TextColorHandler: (visualState: VisualState, selected?: boolean, loading?: boolean) => string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {VisualState} from '../../types/visual-state.enum';
|
|
2
|
+
import {useContext} from 'react';
|
|
3
|
+
import {ThemeCtx} from '../../context/theme.context';
|
|
4
|
+
|
|
5
|
+
export const TextColorHandler = (
|
|
6
|
+
visualState: VisualState,
|
|
7
|
+
selected?: boolean,
|
|
8
|
+
loading?: boolean
|
|
9
|
+
) => {
|
|
10
|
+
const context = useContext(ThemeCtx);
|
|
11
|
+
|
|
12
|
+
const selectedTextColor = context.colors.ui.white;
|
|
13
|
+
const defaultTextColor = context.colors.main['0'];
|
|
14
|
+
const warningTextColor = context.colors.ui.warning.dark;
|
|
15
|
+
const errorTextColor = context.colors.ui.error.dark;
|
|
16
|
+
const successTextColor = context.colors.ui.success.dark;
|
|
17
|
+
|
|
18
|
+
if (visualState === VisualState.DEFAULT) {
|
|
19
|
+
if (selected && loading) return selectedTextColor;
|
|
20
|
+
if (selected && !loading) return selectedTextColor;
|
|
21
|
+
else return selected ? selectedTextColor : defaultTextColor;
|
|
22
|
+
} else if (visualState === VisualState.WARNING) {
|
|
23
|
+
if (selected && loading) return selectedTextColor;
|
|
24
|
+
if (selected && !loading) return selectedTextColor;
|
|
25
|
+
return selected ? selectedTextColor : warningTextColor;
|
|
26
|
+
} else if (visualState === VisualState.ERROR) {
|
|
27
|
+
if (selected && loading) return selectedTextColor;
|
|
28
|
+
if (selected && !loading) return selectedTextColor;
|
|
29
|
+
return selected ? selectedTextColor : errorTextColor;
|
|
30
|
+
} else if (visualState === VisualState.SUCCESS) {
|
|
31
|
+
if (selected && loading) return selectedTextColor;
|
|
32
|
+
if (selected && !loading) return selectedTextColor;
|
|
33
|
+
return selected ? selectedTextColor : successTextColor;
|
|
34
|
+
} else if (visualState != VisualState.INACTIVE)
|
|
35
|
+
return context.colors.ui.white;
|
|
36
|
+
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {VisualState} from '../../types/visual-state.enum';
|
|
2
|
-
import {useContext} from 'react';
|
|
3
|
-
import {ThemeCtx} from '../../context/theme.context';
|
|
4
|
-
|
|
5
|
-
export const TextColorHandler = (
|
|
6
|
-
visualState: VisualState,
|
|
7
|
-
selected?: boolean
|
|
8
|
-
) => {
|
|
9
|
-
const context = useContext(ThemeCtx);
|
|
10
|
-
|
|
11
|
-
const selectedTextColor = context.colors.ui.white;
|
|
12
|
-
const defaultTextColor = context.colors.main['0'];
|
|
13
|
-
const warningTextColor = context.colors.ui.warning.dark;
|
|
14
|
-
const errorTextColor = context.colors.ui.error.dark;
|
|
15
|
-
const successTextColor = context.colors.ui.success.dark;
|
|
16
|
-
|
|
17
|
-
if (visualState === VisualState.DEFAULT)
|
|
18
|
-
return selected ? selectedTextColor : defaultTextColor;
|
|
19
|
-
else if (visualState === VisualState.WARNING)
|
|
20
|
-
return selected ? selectedTextColor : warningTextColor;
|
|
21
|
-
else if (visualState === VisualState.ERROR)
|
|
22
|
-
return selected ? selectedTextColor : errorTextColor;
|
|
23
|
-
else if (visualState === VisualState.SUCCESS)
|
|
24
|
-
return selected ? selectedTextColor : successTextColor;
|
|
25
|
-
else if (visualState != VisualState.INACTIVE) return context.colors.ui.white;
|
|
26
|
-
};
|