@tactics/toddle-styleguide 5.2.2 → 5.3.1
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.tsx +2 -0
- package/package.json +1 -1
- package/src/components/molecules/contact-address/__snapshots__/contact-address.test.js.snap +113 -0
- package/src/components/molecules/contact-address/contact-address.component.d.ts +8 -0
- package/src/components/molecules/contact-address/contact-address.component.tsx +20 -0
- package/src/components/molecules/contact-address/contact-address.preview.d.ts +2 -0
- package/src/components/molecules/contact-address/contact-address.preview.tsx +17 -0
- package/src/components/molecules/contact-address/contact-address.styles.d.ts +7 -0
- package/src/components/molecules/contact-address/contact-address.styles.js +10 -0
- package/src/components/molecules/contact-address/contact-address.test.js +18 -0
- package/src/components/organisms/person-info-card/person-info-card.component.tsx +8 -2
- package/src/components/organisms/person-info-card/person-info-card.preview.tsx +3 -0
- package/src/components/organisms/person-info-card/person-info-card.styles.d.ts +4 -0
- package/src/components/organisms/person-info-card/person-info-card.styles.js +4 -0
package/App.tsx
CHANGED
|
@@ -81,6 +81,8 @@ import { SelectableListItemPreview } from './src/components/molecules/selectable
|
|
|
81
81
|
import {
|
|
82
82
|
SafeAreaProvider,
|
|
83
83
|
} from 'react-native-safe-area-context';
|
|
84
|
+
import {ContactAddress} from './src/components/molecules/contact-address/contact-address.component';
|
|
85
|
+
import {ContactAddressPreview} from './src/components/molecules/contact-address/contact-address.preview';
|
|
84
86
|
|
|
85
87
|
const Stack = createNativeStackNavigator();
|
|
86
88
|
|
|
@@ -128,6 +130,10 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
|
|
|
128
130
|
title="Contact Item"
|
|
129
131
|
onPress={() => navigation.push('contact-item')}
|
|
130
132
|
/>
|
|
133
|
+
<ReactBtn
|
|
134
|
+
title="Contact Address"
|
|
135
|
+
onPress={() => navigation.push('contact-address')}
|
|
136
|
+
/>
|
|
131
137
|
<ReactBtn
|
|
132
138
|
title="Contact Role"
|
|
133
139
|
onPress={() => navigation.push('contact-role')}
|
|
@@ -645,6 +651,11 @@ function App() {
|
|
|
645
651
|
}}>
|
|
646
652
|
{() => <SelectableListItemPreview />}
|
|
647
653
|
</Stack.Screen>
|
|
654
|
+
<Stack.Screen name="contact-address" options={{
|
|
655
|
+
freezeOnBlur: false,
|
|
656
|
+
}}>
|
|
657
|
+
{() => <ContactAddressPreview />}
|
|
658
|
+
</Stack.Screen>
|
|
648
659
|
</Stack.Navigator>
|
|
649
660
|
</NavigationContainer>
|
|
650
661
|
</ThemeCtx.Provider>
|
package/index.tsx
CHANGED
|
@@ -86,6 +86,7 @@ import { InlineNotice } from './src/components/molecules/inline-notice/inline-no
|
|
|
86
86
|
import { SelectableListItem } from './src/components/molecules/selectable-list-item/selectable-list-item.component';
|
|
87
87
|
import { SwipeableContainer } from './src/components/molecules/swipeable/swipeable-container.component';
|
|
88
88
|
import { SwipeableAction } from './src/components/molecules/swipeable/swipeable-action.component';
|
|
89
|
+
import { ContactAddress } from './src/components/molecules/contact-address/contact-address.component';
|
|
89
90
|
|
|
90
91
|
// Exports of enums
|
|
91
92
|
import {BubbleAlignment} from './src/types/bubble-alignment.enum';
|
|
@@ -122,6 +123,7 @@ export {
|
|
|
122
123
|
Check,
|
|
123
124
|
Checkbox,
|
|
124
125
|
ChildListItem,
|
|
126
|
+
ContactAddress,
|
|
125
127
|
ContactItem,
|
|
126
128
|
ContactRole,
|
|
127
129
|
DateInput,
|
package/package.json
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Contact role component test renders a contact who is the father 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"alignItems": "center",
|
|
8
|
+
"display": "flex",
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
>
|
|
12
|
+
<Text
|
|
13
|
+
style={
|
|
14
|
+
[
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"fontFamily": "SourceSansProBold",
|
|
18
|
+
"fontSize": 24,
|
|
19
|
+
"lineHeight": 30.2,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
"color": "#1F2933",
|
|
24
|
+
"textAlign": "center",
|
|
25
|
+
"width": "100%",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"marginBottom": 4,
|
|
29
|
+
},
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
>
|
|
33
|
+
Darth Vader
|
|
34
|
+
</Text>
|
|
35
|
+
<Text
|
|
36
|
+
style={
|
|
37
|
+
[
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
"fontFamily": "Montserrat",
|
|
41
|
+
"fontSize": 13,
|
|
42
|
+
"lineHeight": 20.4,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
{
|
|
46
|
+
"color": "#1F2933",
|
|
47
|
+
"textAlign": "center",
|
|
48
|
+
"width": "100%",
|
|
49
|
+
},
|
|
50
|
+
undefined,
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
I'm your Father
|
|
55
|
+
</Text>
|
|
56
|
+
</View>
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`Contact role component test renders a contact who is the sister 1`] = `
|
|
60
|
+
<View
|
|
61
|
+
style={
|
|
62
|
+
{
|
|
63
|
+
"alignItems": "center",
|
|
64
|
+
"display": "flex",
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
<Text
|
|
69
|
+
style={
|
|
70
|
+
[
|
|
71
|
+
[
|
|
72
|
+
{
|
|
73
|
+
"fontFamily": "SourceSansProBold",
|
|
74
|
+
"fontSize": 24,
|
|
75
|
+
"lineHeight": 30.2,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
{
|
|
79
|
+
"color": "#1F2933",
|
|
80
|
+
"textAlign": "center",
|
|
81
|
+
"width": "100%",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"marginBottom": 4,
|
|
85
|
+
},
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
>
|
|
89
|
+
Princess Leia
|
|
90
|
+
</Text>
|
|
91
|
+
<Text
|
|
92
|
+
style={
|
|
93
|
+
[
|
|
94
|
+
[
|
|
95
|
+
{
|
|
96
|
+
"fontFamily": "Montserrat",
|
|
97
|
+
"fontSize": 13,
|
|
98
|
+
"lineHeight": 20.4,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
{
|
|
102
|
+
"color": "#1F2933",
|
|
103
|
+
"textAlign": "center",
|
|
104
|
+
"width": "100%",
|
|
105
|
+
},
|
|
106
|
+
undefined,
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
>
|
|
110
|
+
Sister
|
|
111
|
+
</Text>
|
|
112
|
+
</View>
|
|
113
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {Stylesheet} from './contact-address.styles';
|
|
4
|
+
import {SmallText} from '../../atoms/paragraph-components';
|
|
5
|
+
|
|
6
|
+
type ContactAddressProps = {
|
|
7
|
+
line1: string;
|
|
8
|
+
line2?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const ContactAddress = ({line1, line2}: ContactAddressProps) => {
|
|
12
|
+
const styles = Stylesheet();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View style={styles.container}>
|
|
16
|
+
<SmallText textAlign={'center'}>{line1}</SmallText>
|
|
17
|
+
{line2 && <SmallText textAlign={'center'}>{line2}</SmallText>}
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ContactAddress} from './contact-address.component';
|
|
3
|
+
const {View} = require('react-native');
|
|
4
|
+
|
|
5
|
+
export const ContactAddressPreview = ({}: {}) => {
|
|
6
|
+
return (
|
|
7
|
+
<View
|
|
8
|
+
style={{
|
|
9
|
+
flex: 1,
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<ContactAddress line1={'Starrenhof 14'} line2={'2950 Kapellen'} />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {ContactRole} from './contact-role.component';
|
|
4
|
+
|
|
5
|
+
describe('Contact role component test', () => {
|
|
6
|
+
it('renders a contact who is the father', function () {
|
|
7
|
+
const tree = render
|
|
8
|
+
.create(<ContactRole name={'Darth Vader'} role={"I'm your Father"} />)
|
|
9
|
+
.toJSON();
|
|
10
|
+
expect(tree).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
it('renders a contact who is the sister', function () {
|
|
13
|
+
const tree = render
|
|
14
|
+
.create(<ContactRole name={'Princess Leia'} role={'Sister'} />)
|
|
15
|
+
.toJSON();
|
|
16
|
+
expect(tree).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {Avatar} from '../../molecules/avatar/avatar.component';
|
|
2
|
-
import {ImageSourcePropType, View, ViewStyle} from 'react-native';
|
|
2
|
+
import {ImageSourcePropType, View, ViewStyle, Text} from 'react-native';
|
|
3
3
|
import {Initials} from '../../../models/initials.model';
|
|
4
4
|
import {Size} from '../../../types/size.enum';
|
|
5
5
|
import {ContactRole} from '../../molecules/contact-role/contact-role.component';
|
|
6
6
|
import {Stylesheet} from './person-info-card.styles';
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import {ContactAddress} from '../../molecules/contact-address/contact-address.component';
|
|
8
9
|
|
|
9
10
|
interface IContactInfoCard {
|
|
10
11
|
source: ImageSourcePropType | Initials;
|
|
@@ -15,6 +16,8 @@ interface IContactInfoCard {
|
|
|
15
16
|
style?: ViewStyle;
|
|
16
17
|
isLoading?: boolean;
|
|
17
18
|
tags?: string[];
|
|
19
|
+
addressLine1?: string;
|
|
20
|
+
addressLine2?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export const PersonInfoCard = ({
|
|
@@ -25,7 +28,9 @@ export const PersonInfoCard = ({
|
|
|
25
28
|
label,
|
|
26
29
|
style,
|
|
27
30
|
isLoading,
|
|
28
|
-
tags
|
|
31
|
+
tags,
|
|
32
|
+
addressLine1,
|
|
33
|
+
addressLine2
|
|
29
34
|
}: IContactInfoCard) => {
|
|
30
35
|
const styles = Stylesheet();
|
|
31
36
|
return (
|
|
@@ -40,6 +45,7 @@ export const PersonInfoCard = ({
|
|
|
40
45
|
/>
|
|
41
46
|
</View>
|
|
42
47
|
<ContactRole name={name} role={label} tags={tags} />
|
|
48
|
+
{ addressLine1 && <View style={styles.addressContainer}><ContactAddress line1={addressLine1} line2={addressLine2}/></View>}
|
|
43
49
|
</View>
|
|
44
50
|
);
|
|
45
51
|
};
|
|
@@ -24,6 +24,8 @@ export const PersonInfoCardPreview = ({}: {}) => {
|
|
|
24
24
|
style={{
|
|
25
25
|
margin: Scale.s,
|
|
26
26
|
}}
|
|
27
|
+
addressLine1={"Starrenhof 12"}
|
|
28
|
+
addressLine2={"2920 Kalmthout"}
|
|
27
29
|
/>
|
|
28
30
|
<PersonInfoCard
|
|
29
31
|
source={Initials.for('Zeno', 'Driesen')}
|
|
@@ -32,6 +34,7 @@ export const PersonInfoCardPreview = ({}: {}) => {
|
|
|
32
34
|
margin: Scale.s,
|
|
33
35
|
}}
|
|
34
36
|
isActive={false}
|
|
37
|
+
addressLine1={"Starrenhof 12"}
|
|
35
38
|
/>
|
|
36
39
|
<PersonInfoCard
|
|
37
40
|
source={Initials.for('Zeno', 'Driesen')}
|