@tactics/toddle-styleguide 1.2.2 → 1.2.4
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 +196 -183
- package/index.d.ts +3 -2
- package/index.tsx +4 -2
- package/package.json +5 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +1776 -596
- package/src/components/atoms/calendar/calendar.component.tsx +8 -6
- package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +70 -62
- package/src/components/molecules/avatar/avatar.component.d.ts +2 -1
- package/src/components/molecules/avatar/avatar.component.tsx +22 -11
- package/src/components/molecules/avatar/avatar.preview.tsx +58 -44
- package/src/components/molecules/avatar/avatar.styles.d.ts +54 -15
- package/src/components/molecules/avatar/avatar.styles.js +33 -5
- package/src/components/molecules/calendar-select/calendar-select.component.d.ts +2 -2
- package/src/components/molecules/calendar-select/calendar-select.component.tsx +4 -14
- package/src/components/molecules/calendar-select/calendar-select.preview.tsx +9 -22
- package/src/components/molecules/date-input/date-input.preview.tsx +25 -23
- package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +2241 -0
- package/src/components/molecules/time-picker/time-picker.component.d.ts +8 -0
- package/src/components/molecules/time-picker/time-picker.component.tsx +91 -0
- package/src/components/molecules/time-picker/time-picker.preview.d.ts +1 -0
- package/src/components/molecules/time-picker/time-picker.preview.tsx +110 -0
- package/src/components/molecules/time-picker/time-picker.styles.d.ts +27 -0
- package/src/components/molecules/time-picker/time-picker.styles.js +31 -0
- package/src/components/molecules/time-picker/time-picker.test.js +18 -0
- package/src/components/molecules/time-tracker/time-tracker.test.js +0 -1
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +47 -39
- package/src/components/molecules/timeline/timeline.component.d.ts +2 -2
- package/src/components/molecules/timeline/timeline.component.tsx +27 -120
- package/src/components/molecules/timeline/timeline.preview.tsx +9 -20
- package/src/components/molecules/timeline/timeline.styles.d.ts +58 -40
- package/src/components/molecules/timeline/timeline.styles.js +24 -17
- package/src/components/molecules/timeline/timeline.test.js +3 -3
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +174 -162
- package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +70 -127
- package/src/components/organisms/contact-item/contact-item.component.tsx +10 -9
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +97 -89
- package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +233 -209
- package/src/components/templates/modal/components/fade-panel.component.d.ts +2 -1
- package/src/components/templates/modal/components/fade-panel.component.tsx +8 -2
- package/src/components/templates/modal/modal.component.d.ts +2 -1
- package/src/components/templates/modal/modal.component.tsx +4 -3
- package/src/components/templates/modal/modal.styles.d.ts +3 -6
- package/src/components/templates/modal/modal.styles.js +3 -3
- package/src/components/templates/popover/components/modal/modal.component.tsx +0 -3
- package/src/components/templates/popover/components/modal/modal.styles.d.ts +2 -1
- package/src/components/templates/popover/components/modal/modal.styles.js +2 -2
- package/src/components/templates/popover/popover.component.tsx +27 -14
- package/src/components/templates/popover/popover.preview.tsx +63 -97
- package/src/components/templates/popover/popover.styles.d.ts +1 -1
- package/src/components/templates/popover/popover.styles.js +3 -1
- package/src/theme/provider/parent.theme.d.ts +4 -1
- package/src/theme/provider/parent.theme.ts +4 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +3 -2
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +9 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +15 -1
- package/src/utilities/toddle-datetime/toddle-datetime.test.js +10 -0
|
@@ -63,18 +63,20 @@ export const Calendar = ({
|
|
|
63
63
|
}: CalendarProps) => {
|
|
64
64
|
const context = useContext(ThemeCtx);
|
|
65
65
|
const styles = Stylesheet(context);
|
|
66
|
-
const initDate = ToddleDateTime.now().toISODate();
|
|
66
|
+
const initDate = ToddleDateTime.now().toISODate() || undefined;
|
|
67
67
|
|
|
68
68
|
const today = selected.toISODate();
|
|
69
69
|
|
|
70
|
-
const marked = useMemo(
|
|
71
|
-
()
|
|
70
|
+
const marked = useMemo(() => {
|
|
71
|
+
if (today === null) {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
72
75
|
[today]: {
|
|
73
76
|
selected: true,
|
|
74
77
|
},
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
+
};
|
|
79
|
+
}, [today]);
|
|
78
80
|
|
|
79
81
|
return (
|
|
80
82
|
<RNCalendar
|
|
@@ -2,88 +2,96 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`test avatar given the isBlocked is true, and provide image source is empty return a red colored avatar 1`] = `
|
|
4
4
|
<View
|
|
5
|
-
style={
|
|
6
|
-
[
|
|
7
|
-
{
|
|
8
|
-
"alignItems": "center",
|
|
9
|
-
"backgroundColor": "#647ACB",
|
|
10
|
-
"justifyContent": "center",
|
|
11
|
-
"overflow": "hidden",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"borderRadius": 20,
|
|
15
|
-
"height": 40,
|
|
16
|
-
"width": 40,
|
|
17
|
-
},
|
|
18
|
-
false,
|
|
19
|
-
false,
|
|
20
|
-
]
|
|
21
|
-
}
|
|
5
|
+
style={null}
|
|
22
6
|
>
|
|
23
|
-
<
|
|
7
|
+
<View
|
|
24
8
|
style={
|
|
25
9
|
[
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
"fontFamily": "SourceSansProBold",
|
|
29
|
-
"fontSize": 18,
|
|
30
|
-
"lineHeight": 22.6,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
10
|
{
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
11
|
+
"alignItems": "center",
|
|
12
|
+
"backgroundColor": "#647ACB",
|
|
13
|
+
"justifyContent": "center",
|
|
14
|
+
"overflow": "hidden",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"borderRadius": 20,
|
|
18
|
+
"height": 40,
|
|
19
|
+
"width": 40,
|
|
37
20
|
},
|
|
38
|
-
|
|
21
|
+
false,
|
|
22
|
+
false,
|
|
39
23
|
]
|
|
40
24
|
}
|
|
41
25
|
>
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
<Text
|
|
27
|
+
style={
|
|
28
|
+
[
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"fontFamily": "SourceSansProBold",
|
|
32
|
+
"fontSize": 18,
|
|
33
|
+
"lineHeight": 22.6,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
{
|
|
37
|
+
"color": "#FFFFFF",
|
|
38
|
+
"textAlign": "center",
|
|
39
|
+
"width": "100%",
|
|
40
|
+
},
|
|
41
|
+
undefined,
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
JD
|
|
46
|
+
</Text>
|
|
47
|
+
</View>
|
|
44
48
|
</View>
|
|
45
49
|
`;
|
|
46
50
|
|
|
47
51
|
exports[`test avatar renders correctly when provided image source is empty 1`] = `
|
|
48
52
|
<View
|
|
49
|
-
style={
|
|
50
|
-
[
|
|
51
|
-
{
|
|
52
|
-
"alignItems": "center",
|
|
53
|
-
"backgroundColor": "#647ACB",
|
|
54
|
-
"justifyContent": "center",
|
|
55
|
-
"overflow": "hidden",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"borderRadius": 20,
|
|
59
|
-
"height": 40,
|
|
60
|
-
"width": 40,
|
|
61
|
-
},
|
|
62
|
-
false,
|
|
63
|
-
false,
|
|
64
|
-
]
|
|
65
|
-
}
|
|
53
|
+
style={null}
|
|
66
54
|
>
|
|
67
|
-
<
|
|
55
|
+
<View
|
|
68
56
|
style={
|
|
69
57
|
[
|
|
70
|
-
[
|
|
71
|
-
{
|
|
72
|
-
"fontFamily": "SourceSansProBold",
|
|
73
|
-
"fontSize": 18,
|
|
74
|
-
"lineHeight": 22.6,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
58
|
{
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
59
|
+
"alignItems": "center",
|
|
60
|
+
"backgroundColor": "#647ACB",
|
|
61
|
+
"justifyContent": "center",
|
|
62
|
+
"overflow": "hidden",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"borderRadius": 20,
|
|
66
|
+
"height": 40,
|
|
67
|
+
"width": 40,
|
|
81
68
|
},
|
|
82
|
-
|
|
69
|
+
false,
|
|
70
|
+
false,
|
|
83
71
|
]
|
|
84
72
|
}
|
|
85
73
|
>
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
<Text
|
|
75
|
+
style={
|
|
76
|
+
[
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
"fontFamily": "SourceSansProBold",
|
|
80
|
+
"fontSize": 18,
|
|
81
|
+
"lineHeight": 22.6,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
{
|
|
85
|
+
"color": "#FFFFFF",
|
|
86
|
+
"textAlign": "center",
|
|
87
|
+
"width": "100%",
|
|
88
|
+
},
|
|
89
|
+
undefined,
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
JD
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
88
96
|
</View>
|
|
89
97
|
`;
|
|
@@ -7,6 +7,7 @@ type AvatarProps = {
|
|
|
7
7
|
isBlocked?: boolean;
|
|
8
8
|
isActive?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
10
|
+
hasShadow?: boolean;
|
|
10
11
|
};
|
|
11
|
-
declare const Avatar: ({ source, size, isBlocked, isActive, isLoading, }: AvatarProps) => JSX.Element;
|
|
12
|
+
declare const Avatar: ({ source, size, isBlocked, isActive, isLoading, hasShadow, }: AvatarProps) => JSX.Element;
|
|
12
13
|
export { Avatar as Avatar };
|
|
@@ -21,6 +21,7 @@ type AvatarProps = {
|
|
|
21
21
|
isBlocked?: boolean;
|
|
22
22
|
isActive?: boolean;
|
|
23
23
|
isLoading?: boolean;
|
|
24
|
+
hasShadow?: boolean;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
const Avatar = ({
|
|
@@ -29,6 +30,7 @@ const Avatar = ({
|
|
|
29
30
|
isBlocked,
|
|
30
31
|
isActive = true,
|
|
31
32
|
isLoading,
|
|
33
|
+
hasShadow,
|
|
32
34
|
}: AvatarProps) => {
|
|
33
35
|
const Context = useContext(ThemeCtx);
|
|
34
36
|
const styles = Stylesheet(Context, size, isBlocked, isActive);
|
|
@@ -69,21 +71,30 @@ const Avatar = ({
|
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
return source instanceof Initials ? (
|
|
72
|
-
<View style={styles.
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
<View style={hasShadow ? styles.shadow : null}>
|
|
75
|
+
<View style={styles.container}>
|
|
76
|
+
{isLoading ? (
|
|
77
|
+
<ActivityIndicator size={'small'} color={Context.colors.ui.white} />
|
|
78
|
+
) : (
|
|
79
|
+
renderText(size)
|
|
80
|
+
)}
|
|
81
|
+
</View>
|
|
78
82
|
</View>
|
|
79
83
|
) : isLoading ? (
|
|
80
|
-
<View style={styles.
|
|
81
|
-
<
|
|
84
|
+
<View style={hasShadow ? styles.shadow : null}>
|
|
85
|
+
<View style={styles.container}>
|
|
86
|
+
{!isBlocked ? <MainGradient isActive={isActive} /> : null}
|
|
87
|
+
<View style={{zIndex: 100, position: 'absolute'}}>
|
|
88
|
+
<ActivityIndicator size={'small'} color={Context.colors.ui.white} />
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
82
91
|
</View>
|
|
83
92
|
) : (
|
|
84
|
-
<View style={styles.
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
<View style={hasShadow ? styles.shadow : null}>
|
|
94
|
+
<View style={styles.container}>
|
|
95
|
+
{!isBlocked ? <MainGradient isActive={isActive} /> : null}
|
|
96
|
+
<Image source={source} style={styles.image as ImageStyle} />
|
|
97
|
+
</View>
|
|
87
98
|
</View>
|
|
88
99
|
);
|
|
89
100
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import {ScrollView} from 'react-native';
|
|
2
3
|
|
|
3
4
|
const {Avatar} = require('./avatar.component');
|
|
4
5
|
const {Size} = require('../../../types/size.enum');
|
|
@@ -7,49 +8,62 @@ const {View} = require('react-native');
|
|
|
7
8
|
|
|
8
9
|
export const AvatarPreview = ({}: {}) => {
|
|
9
10
|
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
11
|
+
<ScrollView>
|
|
12
|
+
<View
|
|
13
|
+
style={{
|
|
14
|
+
flex: 1,
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
backgroundColor: 'white',
|
|
17
|
+
gap: 16,
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<Avatar
|
|
21
|
+
size={Size.LARGE}
|
|
22
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
23
|
+
hasShadow={true}
|
|
24
|
+
isLoading={true}
|
|
25
|
+
/>
|
|
26
|
+
<Avatar
|
|
27
|
+
size={Size.MEDIUM}
|
|
28
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
29
|
+
hasShadow={true}
|
|
30
|
+
/>
|
|
31
|
+
<Avatar
|
|
32
|
+
size={Size.SMALL}
|
|
33
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
34
|
+
/>
|
|
35
|
+
<Avatar
|
|
36
|
+
size={Size.LARGE}
|
|
37
|
+
source={Initials.for('John', 'Doe')}
|
|
38
|
+
hasShadow={true}
|
|
39
|
+
/>
|
|
40
|
+
<Avatar
|
|
41
|
+
size={Size.MEDIUM}
|
|
42
|
+
source={Initials.for('John', 'Doe')}
|
|
43
|
+
isBlocked={true}
|
|
44
|
+
hasShadow={true}
|
|
45
|
+
/>
|
|
46
|
+
<Avatar size={Size.SMALL} source={Initials.for('John', 'Doe')} />
|
|
47
|
+
<Avatar
|
|
48
|
+
size={Size.LARGE}
|
|
49
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
50
|
+
isActive={false}
|
|
51
|
+
hasShadow={true}
|
|
52
|
+
/>
|
|
53
|
+
<Avatar
|
|
54
|
+
size={Size.MEDIUM}
|
|
55
|
+
source={Initials.for('John', 'Doe')}
|
|
56
|
+
isActive={false}
|
|
57
|
+
hasShadow={true}
|
|
58
|
+
/>
|
|
59
|
+
<Avatar
|
|
60
|
+
size={Size.SMALL}
|
|
61
|
+
source={Initials.for('John', 'Doe')}
|
|
62
|
+
isBlocked={true}
|
|
63
|
+
isActive={false}
|
|
64
|
+
hasShadow={true}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
</ScrollView>
|
|
54
68
|
);
|
|
55
69
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function Stylesheet(
|
|
2
|
-
|
|
2
|
+
context: any,
|
|
3
3
|
size: any,
|
|
4
4
|
isBlocked: any,
|
|
5
5
|
isActive: any
|
|
@@ -26,24 +26,63 @@ export function Stylesheet(
|
|
|
26
26
|
alignItems?: undefined;
|
|
27
27
|
}
|
|
28
28
|
)[];
|
|
29
|
+
shadow: (
|
|
30
|
+
| {
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
shadowColor?: undefined;
|
|
33
|
+
shadowOpacity?: undefined;
|
|
34
|
+
shadowRadius?: undefined;
|
|
35
|
+
shadowOffset?: undefined;
|
|
36
|
+
elevation?: undefined;
|
|
37
|
+
width?: undefined;
|
|
38
|
+
height?: undefined;
|
|
39
|
+
borderRadius?: undefined;
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
shadowColor: any;
|
|
43
|
+
shadowOpacity: number;
|
|
44
|
+
shadowRadius: number;
|
|
45
|
+
shadowOffset: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
backgroundColor?: undefined;
|
|
50
|
+
elevation?: undefined;
|
|
51
|
+
width?: undefined;
|
|
52
|
+
height?: undefined;
|
|
53
|
+
borderRadius?: undefined;
|
|
54
|
+
}
|
|
55
|
+
| {
|
|
56
|
+
elevation: number;
|
|
57
|
+
shadowColor: any;
|
|
58
|
+
backgroundColor?: undefined;
|
|
59
|
+
shadowOpacity?: undefined;
|
|
60
|
+
shadowRadius?: undefined;
|
|
61
|
+
shadowOffset?: undefined;
|
|
62
|
+
width?: undefined;
|
|
63
|
+
height?: undefined;
|
|
64
|
+
borderRadius?: undefined;
|
|
65
|
+
}
|
|
66
|
+
| {
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
borderRadius: number;
|
|
70
|
+
backgroundColor?: undefined;
|
|
71
|
+
shadowColor?: undefined;
|
|
72
|
+
shadowOpacity?: undefined;
|
|
73
|
+
shadowRadius?: undefined;
|
|
74
|
+
shadowOffset?: undefined;
|
|
75
|
+
elevation?: undefined;
|
|
76
|
+
}
|
|
77
|
+
)[];
|
|
29
78
|
image: {
|
|
30
79
|
position: string;
|
|
31
80
|
width: string;
|
|
32
81
|
height: string;
|
|
33
82
|
borderRadius: number;
|
|
34
83
|
}[];
|
|
35
|
-
text:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
textTransform: string;
|
|
39
|
-
}
|
|
40
|
-
| {
|
|
41
|
-
fontFamily: string;
|
|
42
|
-
fontSize: number;
|
|
43
|
-
lineHeight: number;
|
|
44
|
-
color?: undefined;
|
|
45
|
-
textTransform?: undefined;
|
|
46
|
-
}
|
|
47
|
-
)[];
|
|
84
|
+
text: {
|
|
85
|
+
textTransform: 'uppercase';
|
|
86
|
+
};
|
|
48
87
|
}>;
|
|
49
|
-
import {StyleSheet} from 'react-native';
|
|
88
|
+
import {StyleSheet} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
1
|
+
import {StyleSheet, Platform} from 'react-native';
|
|
2
2
|
import {Size} from '../../../types/size.enum';
|
|
3
3
|
|
|
4
|
-
export const Stylesheet = (
|
|
4
|
+
export const Stylesheet = (context, size, isBlocked, isActive) =>
|
|
5
5
|
StyleSheet.create({
|
|
6
6
|
container: [
|
|
7
7
|
{
|
|
8
8
|
overflow: 'hidden',
|
|
9
9
|
backgroundColor: isBlocked
|
|
10
|
-
?
|
|
10
|
+
? context.colors.ui.error.default
|
|
11
11
|
: isActive
|
|
12
|
-
?
|
|
13
|
-
:
|
|
12
|
+
? context.colors.main['5']
|
|
13
|
+
: context.colors.ui.lightgrey,
|
|
14
14
|
justifyContent: 'center',
|
|
15
15
|
alignItems: 'center',
|
|
16
16
|
},
|
|
@@ -30,6 +30,34 @@ export const Stylesheet = (Context, size, isBlocked, isActive) =>
|
|
|
30
30
|
borderRadius: 120 / 2,
|
|
31
31
|
},
|
|
32
32
|
],
|
|
33
|
+
shadow: [
|
|
34
|
+
{backgroundColor: 'white'},
|
|
35
|
+
Platform.OS === 'ios' && {
|
|
36
|
+
shadowColor: context.colors.ui.black,
|
|
37
|
+
shadowOpacity: 0.25,
|
|
38
|
+
shadowRadius: 4,
|
|
39
|
+
shadowOffset: {width: 0, height: 4},
|
|
40
|
+
},
|
|
41
|
+
Platform.OS === 'android' && {
|
|
42
|
+
elevation: 6,
|
|
43
|
+
shadowColor: context.colors.ui.black,
|
|
44
|
+
},
|
|
45
|
+
size === Size.SMALL && {
|
|
46
|
+
width: 40,
|
|
47
|
+
height: 40,
|
|
48
|
+
borderRadius: 40 / 2,
|
|
49
|
+
},
|
|
50
|
+
size === Size.MEDIUM && {
|
|
51
|
+
width: 72,
|
|
52
|
+
height: 72,
|
|
53
|
+
borderRadius: 72 / 2,
|
|
54
|
+
},
|
|
55
|
+
size === Size.LARGE && {
|
|
56
|
+
width: 120,
|
|
57
|
+
height: 120,
|
|
58
|
+
borderRadius: 120 / 2,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
33
61
|
image: [
|
|
34
62
|
{
|
|
35
63
|
position: 'absolute',
|
|
@@ -2,8 +2,8 @@ import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-dateti
|
|
|
2
2
|
type CalendarSelectProps = {
|
|
3
3
|
onPressDate: (date: ToddleDateTime) => void;
|
|
4
4
|
startDate: ToddleDateTime;
|
|
5
|
-
pressChevronRight
|
|
6
|
-
pressChevronLeft
|
|
5
|
+
pressChevronRight: (date: ToddleDateTime) => void;
|
|
6
|
+
pressChevronLeft: (date: ToddleDateTime) => void;
|
|
7
7
|
};
|
|
8
8
|
declare const CalendarSelect: ({ onPressDate, startDate, pressChevronLeft, pressChevronRight, }: CalendarSelectProps) => JSX.Element;
|
|
9
9
|
export { CalendarSelect as CalendarSelect };
|
|
@@ -10,8 +10,8 @@ import {Icon} from '../../../icons/index';
|
|
|
10
10
|
type CalendarSelectProps = {
|
|
11
11
|
onPressDate: (date: ToddleDateTime) => void;
|
|
12
12
|
startDate: ToddleDateTime;
|
|
13
|
-
pressChevronRight
|
|
14
|
-
pressChevronLeft
|
|
13
|
+
pressChevronRight: (date: ToddleDateTime) => void;
|
|
14
|
+
pressChevronLeft: (date: ToddleDateTime) => void;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const CalendarSelect = ({
|
|
@@ -29,20 +29,11 @@ const CalendarSelect = ({
|
|
|
29
29
|
setVisibleDate(startDate);
|
|
30
30
|
}, [startDate]);
|
|
31
31
|
|
|
32
|
-
const onPressRight = () => {
|
|
33
|
-
setVisibleDate(visibleDate.plus({days: 1}));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const onPressLeft = () => {
|
|
37
|
-
setVisibleDate(visibleDate.minus({days: 1}));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
32
|
return (
|
|
41
33
|
<View style={styles.container}>
|
|
42
34
|
<Pressable
|
|
43
35
|
onPress={() => {
|
|
44
|
-
|
|
45
|
-
if (pressChevronLeft) pressChevronLeft(visibleDate.minus({days: 1}));
|
|
36
|
+
pressChevronLeft(visibleDate.minus({days: 1}));
|
|
46
37
|
}}
|
|
47
38
|
>
|
|
48
39
|
<Icon style={'regular'} name={'chevron-left'} />
|
|
@@ -68,8 +59,7 @@ const CalendarSelect = ({
|
|
|
68
59
|
|
|
69
60
|
<Pressable
|
|
70
61
|
onPress={() => {
|
|
71
|
-
|
|
72
|
-
if (pressChevronRight) pressChevronRight(visibleDate.plus({days: 1}));
|
|
62
|
+
pressChevronRight(visibleDate.plus({days: 1}));
|
|
73
63
|
}}
|
|
74
64
|
>
|
|
75
65
|
<Icon style={'regular'} name={'chevron-right'} />
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {CalendarSelect} from './calendar-select.component';
|
|
4
4
|
import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
5
5
|
|
|
6
6
|
export const CalendarSelectPreview = ({}: {}) => {
|
|
7
|
+
const [date, setDate] = useState(
|
|
8
|
+
ToddleDateTime.local({zone: 'America/Los_Angeles'})
|
|
9
|
+
);
|
|
10
|
+
console.log(date);
|
|
7
11
|
return (
|
|
8
12
|
<View>
|
|
9
13
|
<CalendarSelect
|
|
10
|
-
onPressDate={(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'date is:',
|
|
15
|
-
date.toLocaleString(ToddleDateTime.DATE_MED)
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
startDate={ToddleDateTime.now()}
|
|
19
|
-
pressChevronRight={(date) =>
|
|
20
|
-
console.log(
|
|
21
|
-
'pijl rechts gedrukt, aangepaste data=',
|
|
22
|
-
date.toLocaleString()
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
pressChevronLeft={(date) =>
|
|
26
|
-
console.log(
|
|
27
|
-
'pijl links gedrukt, aangepaste data=',
|
|
28
|
-
date.toLocaleString()
|
|
29
|
-
)
|
|
30
|
-
}
|
|
14
|
+
onPressDate={() => console.log('open modal')}
|
|
15
|
+
startDate={date}
|
|
16
|
+
pressChevronRight={setDate}
|
|
17
|
+
pressChevronLeft={setDate}
|
|
31
18
|
/>
|
|
32
19
|
</View>
|
|
33
20
|
);
|
|
@@ -7,6 +7,7 @@ import {TextInput} from '../../atoms/text-input/text-input.component';
|
|
|
7
7
|
import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
|
|
8
8
|
import {Popover} from '../../templates/popover/popover.component';
|
|
9
9
|
import {Calendar} from '../../atoms/calendar/calendar.component';
|
|
10
|
+
import {Modal} from '../../templates/modal/modal.component';
|
|
10
11
|
|
|
11
12
|
const {View} = require('react-native');
|
|
12
13
|
|
|
@@ -15,30 +16,31 @@ export const DateInputPreview = ({}: {}) => {
|
|
|
15
16
|
const [popoverIsVisible, setPopoverIsVisible] = useState(false);
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Text>Kind</Text>
|
|
31
|
-
<TextInput
|
|
32
|
-
keyboardType={KeyBoardTypes.DEFAULT}
|
|
33
|
-
placeholder={'De uiltjes'}
|
|
34
|
-
/>
|
|
19
|
+
<>
|
|
20
|
+
<View
|
|
21
|
+
style={{
|
|
22
|
+
padding: 50,
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<Info
|
|
26
|
+
label={'Afwezigheid melden'}
|
|
27
|
+
description={
|
|
28
|
+
'Kan u kind een dag niet aanwezig zijn? Laat het via deze weg weten aan de opvanglocatie.'
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
<Text>Kind</Text>
|
|
33
|
+
<TextInput
|
|
34
|
+
keyboardType={KeyBoardTypes.DEFAULT}
|
|
35
|
+
placeholder={'De uiltjes'}
|
|
36
|
+
/>
|
|
41
37
|
|
|
38
|
+
<Text>Afwezig op</Text>
|
|
39
|
+
<DateInput
|
|
40
|
+
value={selectedDate}
|
|
41
|
+
onPress={() => setPopoverIsVisible(true)}
|
|
42
|
+
/>
|
|
43
|
+
</View>
|
|
42
44
|
<Popover
|
|
43
45
|
onClose={() => setPopoverIsVisible(false)}
|
|
44
46
|
title={'Datum'}
|
|
@@ -55,6 +57,6 @@ export const DateInputPreview = ({}: {}) => {
|
|
|
55
57
|
/>
|
|
56
58
|
</View>
|
|
57
59
|
</Popover>
|
|
58
|
-
|
|
60
|
+
</>
|
|
59
61
|
);
|
|
60
62
|
};
|