@tactics/toddle-styleguide 0.0.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/.expo-shared/assets.json +4 -0
- package/.github/workflows/run-tests.yml +16 -0
- package/.prettierrc.js +9 -0
- package/.yarnrc.yml +1 -0
- package/App.tsx +221 -0
- package/app.json +33 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/components/avatar/baby.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/montserrat/bold.ttf +0 -0
- package/assets/fonts/montserrat/regular.ttf +0 -0
- package/assets/fonts/source-sans-pro/bold.ttf +0 -0
- package/assets/fonts/source-sans-pro/regular.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +6 -0
- package/jest.config.js +22 -0
- package/package.json +53 -0
- package/src/components/atoms/avatar/__snapshots__/avatar.test.js.snap +85 -0
- package/src/components/atoms/avatar/avatar.component.tsx +35 -0
- package/src/components/atoms/avatar/avatar.preview.tsx +38 -0
- package/src/components/atoms/avatar/avatar.styles.js +55 -0
- package/src/components/atoms/avatar/avatar.test.js +22 -0
- package/src/components/atoms/button/__snapshots__/button.test.js.snap +307 -0
- package/src/components/atoms/button/button.component.tsx +27 -0
- package/src/components/atoms/button/button.preview.tsx +34 -0
- package/src/components/atoms/button/button.styles.js +25 -0
- package/src/components/atoms/button/button.test.js +35 -0
- package/src/components/atoms/cancel-link/__snapshots__/cancel-link.test.js.snap +89 -0
- package/src/components/atoms/cancel-link/cancel-link.component.tsx +24 -0
- package/src/components/atoms/cancel-link/cancel-link.preview.tsx +20 -0
- package/src/components/atoms/cancel-link/cancel-link.styles.js +20 -0
- package/src/components/atoms/cancel-link/cancel-link.test.js +28 -0
- package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +67 -0
- package/src/components/atoms/check-switch/check-switch.component.tsx +46 -0
- package/src/components/atoms/check-switch/check-switch.preview.tsx +31 -0
- package/src/components/atoms/check-switch/check-switch.styles.js +36 -0
- package/src/components/atoms/check-switch/check-switch.test.js +13 -0
- package/src/components/atoms/checkbox/__snapshots__/checkbox.test.js.snap +120 -0
- package/src/components/atoms/checkbox/checkbox.component.tsx +26 -0
- package/src/components/atoms/checkbox/checkbox.preview.tsx +46 -0
- package/src/components/atoms/checkbox/checkbox.styles.js +35 -0
- package/src/components/atoms/checkbox/checkbox.test.js +30 -0
- package/src/components/atoms/child-list-item/__snapshots__/child-list-item.test.js.snap +635 -0
- package/src/components/atoms/child-list-item/child-list-item.component.tsx +81 -0
- package/src/components/atoms/child-list-item/child-list-item.preview.tsx +65 -0
- package/src/components/atoms/child-list-item/child-list-item.styles.js +82 -0
- package/src/components/atoms/child-list-item/child-list-item.test.js +73 -0
- package/src/components/atoms/contact-item/__snapshots__/contact-item.test.js.snap +321 -0
- package/src/components/atoms/contact-item/contact-item.component.tsx +61 -0
- package/src/components/atoms/contact-item/contact-item.preview.tsx +30 -0
- package/src/components/atoms/contact-item/contact-item.styles.js +26 -0
- package/src/components/atoms/contact-item/contact-item.test.js +20 -0
- package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +415 -0
- package/src/components/atoms/filter-tab/filter-tab.component.tsx +93 -0
- package/src/components/atoms/filter-tab/filter-tab.preview.tsx +37 -0
- package/src/components/atoms/filter-tab/filter-tab.styles.js +64 -0
- package/src/components/atoms/filter-tab/filter-tab.test.js +38 -0
- package/src/components/atoms/form-actions/__snapshots__/form-action.test.js.snap +176 -0
- package/src/components/atoms/form-actions/form-action.component.tsx +25 -0
- package/src/components/atoms/form-actions/form-action.preview.tsx +29 -0
- package/src/components/atoms/form-actions/form-action.styles.js +19 -0
- package/src/components/atoms/form-actions/form-action.test.js +32 -0
- package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +67 -0
- package/src/components/atoms/image-bubble/image-bubble.component.tsx +25 -0
- package/src/components/atoms/image-bubble/image-bubble.preview.tsx +19 -0
- package/src/components/atoms/image-bubble/image-bubble.styles.js +31 -0
- package/src/components/atoms/image-bubble/image-bubble.test.js +20 -0
- package/src/components/atoms/info/__snapshots__/info.test.js.snap +43 -0
- package/src/components/atoms/info/info.component.tsx +22 -0
- package/src/components/atoms/info/info.preview.tsx +20 -0
- package/src/components/atoms/info/info.styles.js +25 -0
- package/src/components/atoms/info/info.test.js +18 -0
- package/src/components/atoms/pill/__snapshots__/pill.test.js.snap +141 -0
- package/src/components/atoms/pill/pill.component.tsx +23 -0
- package/src/components/atoms/pill/pill.preview.tsx +21 -0
- package/src/components/atoms/pill/pill.styles.js +32 -0
- package/src/components/atoms/pill/pill.test.js +34 -0
- package/src/components/atoms/popover/components/backdrop/backdrop.component.tsx +40 -0
- package/src/components/atoms/popover/components/backdrop/backdrop.styles.js +15 -0
- package/src/components/atoms/popover/components/foreground/foreground.component.tsx +17 -0
- package/src/components/atoms/popover/components/foreground/foreground.styles.js +17 -0
- package/src/components/atoms/popover/components/index.js +5 -0
- package/src/components/atoms/popover/components/modal/close/close.component.tsx +21 -0
- package/src/components/atoms/popover/components/modal/close/close.styles.js +13 -0
- package/src/components/atoms/popover/components/modal/heading/heading.component.tsx +22 -0
- package/src/components/atoms/popover/components/modal/heading/heading.styles.js +24 -0
- package/src/components/atoms/popover/components/modal/modal.component.tsx +87 -0
- package/src/components/atoms/popover/components/modal/modal.styles.js +23 -0
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.tsx +18 -0
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.styles.js +10 -0
- package/src/components/atoms/popover/popover.component.tsx +60 -0
- package/src/components/atoms/popover/popover.preview.tsx +135 -0
- package/src/components/atoms/popover/popover.styles.js +12 -0
- package/src/components/atoms/popover-heading/__snapshots__/popover_heading.test.js.snap +35 -0
- package/src/components/atoms/popover-heading/popover-heading.component.tsx +22 -0
- package/src/components/atoms/popover-heading/popover-heading.preview.tsx +18 -0
- package/src/components/atoms/popover-heading/popover-heading.styles.js +19 -0
- package/src/components/atoms/popover-heading/popover_heading.test.js +11 -0
- package/src/components/atoms/pressable-icon/__snapshots__/pressable-icon.test.js.snap +364 -0
- package/src/components/atoms/pressable-icon/pressable-icon.component.tsx +48 -0
- package/src/components/atoms/pressable-icon/pressable-icon.preview.tsx +37 -0
- package/src/components/atoms/pressable-icon/pressable-icon.styles.js +25 -0
- package/src/components/atoms/pressable-icon/pressable-icon.test.js +47 -0
- package/src/components/atoms/quick-filter/__snapshots__/quick-filter.test.js.snap +465 -0
- package/src/components/atoms/quick-filter/quick-filter.component.tsx +32 -0
- package/src/components/atoms/quick-filter/quick-filter.prevriew.tsx +46 -0
- package/src/components/atoms/quick-filter/quick-filter.styles.js +68 -0
- package/src/components/atoms/quick-filter/quick-filter.test.js +127 -0
- package/src/components/atoms/select-list-item/__snapshots__/select-list-item.test.js.snap +391 -0
- package/src/components/atoms/select-list-item/select-list-item-preview.tsx +31 -0
- package/src/components/atoms/select-list-item/select-list-item.test.js +38 -0
- package/src/components/atoms/select-list-item/select-list.component-item.tsx +52 -0
- package/src/components/atoms/select-list-item/select-list.styles-item.js +40 -0
- package/src/components/atoms/snackbar/__snapshots__/snackbar.test.js.snap +493 -0
- package/src/components/atoms/snackbar/snackbar.component.tsx +28 -0
- package/src/components/atoms/snackbar/snackbar.preview.tsx +33 -0
- package/src/components/atoms/snackbar/snackbar.styles.js +82 -0
- package/src/components/atoms/snackbar/snackbar.test.js +35 -0
- package/src/components/atoms/tag/__snapshots__/tag.test.js.snap +87 -0
- package/src/components/atoms/tag/tag.component.tsx +37 -0
- package/src/components/atoms/tag/tag.preview.tsx +27 -0
- package/src/components/atoms/tag/tag.styles.js +22 -0
- package/src/components/atoms/tag/tag.test.js +24 -0
- package/src/components/atoms/text-bubble/__snapshots__/text-bubble.test.js.snap +337 -0
- package/src/components/atoms/text-bubble/text-bubble.component.tsx +32 -0
- package/src/components/atoms/text-bubble/text-bubble.preview.tsx +27 -0
- package/src/components/atoms/text-bubble/text-bubble.styles.js +64 -0
- package/src/components/atoms/text-bubble/text-bubble.test.js +84 -0
- package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +68 -0
- package/src/components/atoms/text-input/text-input.component.tsx +32 -0
- package/src/components/atoms/text-input/text-input.preview.tsx +24 -0
- package/src/components/atoms/text-input/text-input.styles.js +26 -0
- package/src/components/atoms/text-input/text-input.test.js +32 -0
- package/src/components/atoms/time-tracker/__snapshots__/time-tracker.test.js.snap +206 -0
- package/src/components/atoms/time-tracker/time-tracker.component.tsx +24 -0
- package/src/components/atoms/time-tracker/time-tracker.preview.tsx +15 -0
- package/src/components/atoms/time-tracker/time-tracker.styles.js +36 -0
- package/src/components/atoms/time-tracker/time-tracker.test.js +37 -0
- package/src/components/atoms/wide-button/__snapshots__/wide-button.test.js.snap +92 -0
- package/src/components/atoms/wide-button/wide-button.component.tsx +23 -0
- package/src/components/atoms/wide-button/wide-button.preview.tsx +18 -0
- package/src/components/atoms/wide-button/wide-button.styles.js +22 -0
- package/src/components/atoms/wide-button/wide-button.test.js +16 -0
- package/src/context/theme.context.ts +49 -0
- package/src/gradients/main/main.gradient.tsx +20 -0
- package/src/gradients/main/main.styles.js +11 -0
- package/src/icons/__snapshots__/icons.test.js.snap +2588 -0
- package/src/icons/icons.test.js +245 -0
- package/src/icons/index.tsx +7 -0
- package/src/icons/outline/calendar/calendar.icon.tsx +20 -0
- package/src/icons/outline/chat/chat.icon.tsx +20 -0
- package/src/icons/outline/chat-alt/chat-alt.icon.tsx +20 -0
- package/src/icons/outline/check-circle/check-circle.icon.tsx +20 -0
- package/src/icons/outline/chevron-left/chevron-left.icon.tsx +20 -0
- package/src/icons/outline/chevron-right/chevron-right.icon.tsx +20 -0
- package/src/icons/outline/clock/clock.icon.tsx +20 -0
- package/src/icons/outline/cloud-download/cloud-download.icon.tsx +20 -0
- package/src/icons/outline/cross/cross.icon.tsx +20 -0
- package/src/icons/outline/currency-euro/currency-euro.icon.tsx +20 -0
- package/src/icons/outline/document-text/document-text.icon.tsx +20 -0
- package/src/icons/outline/exclamation/exclamation.icon.tsx +20 -0
- package/src/icons/outline/exclamation-circle/exclamation-circle.icon.tsx +20 -0
- package/src/icons/outline/eye/eye.icon.tsx +27 -0
- package/src/icons/outline/filter/filter.icon.tsx +59 -0
- package/src/icons/outline/information-circle/information-circle.icon.tsx +20 -0
- package/src/icons/outline/logout/logout.icon.tsx +20 -0
- package/src/icons/outline/mail/mail.icon.tsx +20 -0
- package/src/icons/outline/mail-open/mail-open.icon.tsx +20 -0
- package/src/icons/outline/menu/menu.icon.tsx +20 -0
- package/src/icons/outline/minus-sm/minus-sm.icon.tsx +20 -0
- package/src/icons/outline/office-building/office-building.icon.tsx +20 -0
- package/src/icons/outline/outline-default.preview.tsx +99 -0
- package/src/icons/outline/outline-grey.preview.tsx +100 -0
- package/src/icons/outline/outline-white.preview.tsx +100 -0
- package/src/icons/outline/outline.tsx +81 -0
- package/src/icons/outline/paper-airplane/paper-airplane.icon.tsx +20 -0
- package/src/icons/outline/paperclip/paperclip.icon.tsx +20 -0
- package/src/icons/outline/pencil/pencil.icon.tsx +20 -0
- package/src/icons/outline/phone/phone.icon.tsx +20 -0
- package/src/icons/outline/plus/plus.icon.tsx +20 -0
- package/src/icons/outline/plus-sm/plus-sm.icon.tsx +20 -0
- package/src/icons/outline/qrcode/qrcode.icon.tsx +17 -0
- package/src/icons/outline/refresh/refresh.icon.tsx +20 -0
- package/src/icons/outline/search/search.icon.tsx +20 -0
- package/src/icons/outline/selector/selector.icon.tsx +20 -0
- package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.tsx +20 -0
- package/src/icons/outline/status-online/status-online.icon.tsx +20 -0
- package/src/icons/outline/thumb-up/thumb-up.icon.tsx +20 -0
- package/src/icons/outline/trash/trash.icon.tsx +20 -0
- package/src/icons/outline/user/user.icon.tsx +27 -0
- package/src/icons/outline/user-group/user-group.icon.tsx +20 -0
- package/src/icons/outline/users/users.icon.tsx +20 -0
- package/src/icons/solid/chat-alt/chat-alt-solid.icon.tsx +20 -0
- package/src/icons/solid/clock/clock-solid.icon.tsx +20 -0
- package/src/icons/solid/information-circle/information-circle-solid.icon.tsx +20 -0
- package/src/icons/solid/pencil/pencil-solid.icon.tsx +22 -0
- package/src/icons/solid/phone/phone-solid.icon.tsx +18 -0
- package/src/icons/solid/refresh/refresh-solid.icon.tsx +20 -0
- package/src/icons/solid/solid.preview.tsx +73 -0
- package/src/icons/solid/solid.tsx +19 -0
- package/src/icons/solid/status-online/status-online-solid.icon.tsx +24 -0
- package/src/icons/solid/trash/trash-solid.icon.tsx +20 -0
- package/src/models/hex-color.model.ts +25 -0
- package/src/models/hex-color.test.js +20 -0
- package/src/models/initials.model.ts +32 -0
- package/src/models/initials.test.js +23 -0
- package/src/theme/font/font.ts +72 -0
- package/src/theme/font/index.ts +4 -0
- package/src/theme/font/load-fonts.ts +10 -0
- package/src/theme/provider/index.ts +4 -0
- package/src/theme/provider/parent.theme.ts +45 -0
- package/src/theme/provider/staff-member.theme.ts +45 -0
- package/src/theme/scale/index.ts +14 -0
- package/src/types/bubble-alignment.enum.ts +4 -0
- package/src/types/icontype.type.ts +3 -0
- package/src/types/keyboard-types.enum.ts +9 -0
- package/src/types/size.enum.ts +5 -0
- package/src/types/visual-state.enum.ts +6 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"backgroundColor": "#E5E8EB",
|
|
8
|
+
"borderRadius": 16,
|
|
9
|
+
"display": "flex",
|
|
10
|
+
"paddingBottom": 4,
|
|
11
|
+
"paddingLeft": 4,
|
|
12
|
+
"paddingRight": 4,
|
|
13
|
+
"paddingTop": 4,
|
|
14
|
+
"width": "100%",
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
<View
|
|
19
|
+
onLayout={[Function]}
|
|
20
|
+
style={
|
|
21
|
+
{
|
|
22
|
+
"display": "flex",
|
|
23
|
+
"width": "100%",
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
>
|
|
27
|
+
<View
|
|
28
|
+
style={
|
|
29
|
+
{
|
|
30
|
+
"display": "flex",
|
|
31
|
+
"flexDirection": "column",
|
|
32
|
+
"position": "relative",
|
|
33
|
+
"width": "100%",
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
<View
|
|
38
|
+
accessible={true}
|
|
39
|
+
collapsable={false}
|
|
40
|
+
focusable={true}
|
|
41
|
+
onBlur={[Function]}
|
|
42
|
+
onClick={[Function]}
|
|
43
|
+
onFocus={[Function]}
|
|
44
|
+
onResponderGrant={[Function]}
|
|
45
|
+
onResponderMove={[Function]}
|
|
46
|
+
onResponderRelease={[Function]}
|
|
47
|
+
onResponderTerminate={[Function]}
|
|
48
|
+
onResponderTerminationRequest={[Function]}
|
|
49
|
+
onStartShouldSetResponder={[Function]}
|
|
50
|
+
style={
|
|
51
|
+
{
|
|
52
|
+
"alignItems": "center",
|
|
53
|
+
"backgroundColor": "transparent",
|
|
54
|
+
"borderRadius": 16,
|
|
55
|
+
"paddingBottom": 8,
|
|
56
|
+
"paddingLeft": 16,
|
|
57
|
+
"paddingRight": 16,
|
|
58
|
+
"paddingTop": 8,
|
|
59
|
+
"width": 0,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
<Text
|
|
64
|
+
style={
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
"color": "#1F2933",
|
|
68
|
+
"fontFamily": "SourceSansPro",
|
|
69
|
+
"fontSize": 16,
|
|
70
|
+
"lineHeight": 22.4,
|
|
71
|
+
"maxHeight": 32,
|
|
72
|
+
"overflow": "hidden",
|
|
73
|
+
"textAlign": "center",
|
|
74
|
+
"textOverflow": "ellipsis",
|
|
75
|
+
"whiteSpace": "nowrap",
|
|
76
|
+
"width": "100%",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"color": "#FFFFFF",
|
|
80
|
+
},
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
QR-Code
|
|
85
|
+
</Text>
|
|
86
|
+
</View>
|
|
87
|
+
<View
|
|
88
|
+
accessible={true}
|
|
89
|
+
collapsable={false}
|
|
90
|
+
focusable={true}
|
|
91
|
+
onBlur={[Function]}
|
|
92
|
+
onClick={[Function]}
|
|
93
|
+
onFocus={[Function]}
|
|
94
|
+
onResponderGrant={[Function]}
|
|
95
|
+
onResponderMove={[Function]}
|
|
96
|
+
onResponderRelease={[Function]}
|
|
97
|
+
onResponderTerminate={[Function]}
|
|
98
|
+
onResponderTerminationRequest={[Function]}
|
|
99
|
+
onStartShouldSetResponder={[Function]}
|
|
100
|
+
style={
|
|
101
|
+
{
|
|
102
|
+
"alignItems": "center",
|
|
103
|
+
"backgroundColor": "transparent",
|
|
104
|
+
"borderRadius": 16,
|
|
105
|
+
"paddingBottom": 8,
|
|
106
|
+
"paddingLeft": 16,
|
|
107
|
+
"paddingRight": 16,
|
|
108
|
+
"paddingTop": 8,
|
|
109
|
+
"width": 0,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<Text
|
|
114
|
+
style={
|
|
115
|
+
[
|
|
116
|
+
{
|
|
117
|
+
"color": "#1F2933",
|
|
118
|
+
"fontFamily": "SourceSansPro",
|
|
119
|
+
"fontSize": 16,
|
|
120
|
+
"lineHeight": 22.4,
|
|
121
|
+
"maxHeight": 32,
|
|
122
|
+
"overflow": "hidden",
|
|
123
|
+
"textAlign": "center",
|
|
124
|
+
"textOverflow": "ellipsis",
|
|
125
|
+
"whiteSpace": "nowrap",
|
|
126
|
+
"width": "100%",
|
|
127
|
+
},
|
|
128
|
+
false,
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
NFC
|
|
133
|
+
</Text>
|
|
134
|
+
</View>
|
|
135
|
+
<View
|
|
136
|
+
collapsable={false}
|
|
137
|
+
style={
|
|
138
|
+
{
|
|
139
|
+
"alignItems": "center",
|
|
140
|
+
"backgroundColor": "#647ACB",
|
|
141
|
+
"borderRadius": 16,
|
|
142
|
+
"paddingBottom": 8,
|
|
143
|
+
"paddingLeft": 16,
|
|
144
|
+
"paddingRight": 16,
|
|
145
|
+
"paddingTop": 8,
|
|
146
|
+
"position": "absolute",
|
|
147
|
+
"transform": [
|
|
148
|
+
{
|
|
149
|
+
"translateY": 0,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
"width": 0,
|
|
153
|
+
"zIndex": -1,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
<Text
|
|
158
|
+
style={
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
"color": "#1F2933",
|
|
162
|
+
"fontFamily": "SourceSansPro",
|
|
163
|
+
"fontSize": 16,
|
|
164
|
+
"lineHeight": 22.4,
|
|
165
|
+
"maxHeight": 32,
|
|
166
|
+
"overflow": "hidden",
|
|
167
|
+
"textAlign": "center",
|
|
168
|
+
"textOverflow": "ellipsis",
|
|
169
|
+
"whiteSpace": "nowrap",
|
|
170
|
+
"width": "100%",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"opacity": 0,
|
|
174
|
+
},
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
>
|
|
178
|
+
Hidden dsfdslflsd lfdslf lsdlfdslf lsdfl sdfl sfdl sdfl dsfl
|
|
179
|
+
</Text>
|
|
180
|
+
</View>
|
|
181
|
+
</View>
|
|
182
|
+
</View>
|
|
183
|
+
</View>
|
|
184
|
+
`;
|
|
185
|
+
|
|
186
|
+
exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
|
|
187
|
+
<View
|
|
188
|
+
style={
|
|
189
|
+
{
|
|
190
|
+
"backgroundColor": "#E5E8EB",
|
|
191
|
+
"borderRadius": 16,
|
|
192
|
+
"display": "flex",
|
|
193
|
+
"paddingBottom": 4,
|
|
194
|
+
"paddingLeft": 4,
|
|
195
|
+
"paddingRight": 4,
|
|
196
|
+
"paddingTop": 4,
|
|
197
|
+
"width": "100%",
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
>
|
|
201
|
+
<View
|
|
202
|
+
onLayout={[Function]}
|
|
203
|
+
style={
|
|
204
|
+
{
|
|
205
|
+
"display": "flex",
|
|
206
|
+
"width": "100%",
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
>
|
|
210
|
+
<View
|
|
211
|
+
style={
|
|
212
|
+
{
|
|
213
|
+
"display": "flex",
|
|
214
|
+
"flexDirection": "column",
|
|
215
|
+
"position": "relative",
|
|
216
|
+
"width": "100%",
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
>
|
|
220
|
+
<View
|
|
221
|
+
accessible={true}
|
|
222
|
+
collapsable={false}
|
|
223
|
+
focusable={true}
|
|
224
|
+
onBlur={[Function]}
|
|
225
|
+
onClick={[Function]}
|
|
226
|
+
onFocus={[Function]}
|
|
227
|
+
onResponderGrant={[Function]}
|
|
228
|
+
onResponderMove={[Function]}
|
|
229
|
+
onResponderRelease={[Function]}
|
|
230
|
+
onResponderTerminate={[Function]}
|
|
231
|
+
onResponderTerminationRequest={[Function]}
|
|
232
|
+
onStartShouldSetResponder={[Function]}
|
|
233
|
+
style={
|
|
234
|
+
{
|
|
235
|
+
"alignItems": "center",
|
|
236
|
+
"backgroundColor": "transparent",
|
|
237
|
+
"borderRadius": 16,
|
|
238
|
+
"paddingBottom": 8,
|
|
239
|
+
"paddingLeft": 16,
|
|
240
|
+
"paddingRight": 16,
|
|
241
|
+
"paddingTop": 8,
|
|
242
|
+
"width": 0,
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
>
|
|
246
|
+
<Text
|
|
247
|
+
style={
|
|
248
|
+
[
|
|
249
|
+
{
|
|
250
|
+
"color": "#1F2933",
|
|
251
|
+
"fontFamily": "SourceSansPro",
|
|
252
|
+
"fontSize": 16,
|
|
253
|
+
"lineHeight": 22.4,
|
|
254
|
+
"maxHeight": 32,
|
|
255
|
+
"overflow": "hidden",
|
|
256
|
+
"textAlign": "center",
|
|
257
|
+
"textOverflow": "ellipsis",
|
|
258
|
+
"whiteSpace": "nowrap",
|
|
259
|
+
"width": "100%",
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"color": "#FFFFFF",
|
|
263
|
+
},
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
>
|
|
267
|
+
Jongen
|
|
268
|
+
</Text>
|
|
269
|
+
</View>
|
|
270
|
+
<View
|
|
271
|
+
accessible={true}
|
|
272
|
+
collapsable={false}
|
|
273
|
+
focusable={true}
|
|
274
|
+
onBlur={[Function]}
|
|
275
|
+
onClick={[Function]}
|
|
276
|
+
onFocus={[Function]}
|
|
277
|
+
onResponderGrant={[Function]}
|
|
278
|
+
onResponderMove={[Function]}
|
|
279
|
+
onResponderRelease={[Function]}
|
|
280
|
+
onResponderTerminate={[Function]}
|
|
281
|
+
onResponderTerminationRequest={[Function]}
|
|
282
|
+
onStartShouldSetResponder={[Function]}
|
|
283
|
+
style={
|
|
284
|
+
{
|
|
285
|
+
"alignItems": "center",
|
|
286
|
+
"backgroundColor": "transparent",
|
|
287
|
+
"borderRadius": 16,
|
|
288
|
+
"paddingBottom": 8,
|
|
289
|
+
"paddingLeft": 16,
|
|
290
|
+
"paddingRight": 16,
|
|
291
|
+
"paddingTop": 8,
|
|
292
|
+
"width": 0,
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
>
|
|
296
|
+
<Text
|
|
297
|
+
style={
|
|
298
|
+
[
|
|
299
|
+
{
|
|
300
|
+
"color": "#1F2933",
|
|
301
|
+
"fontFamily": "SourceSansPro",
|
|
302
|
+
"fontSize": 16,
|
|
303
|
+
"lineHeight": 22.4,
|
|
304
|
+
"maxHeight": 32,
|
|
305
|
+
"overflow": "hidden",
|
|
306
|
+
"textAlign": "center",
|
|
307
|
+
"textOverflow": "ellipsis",
|
|
308
|
+
"whiteSpace": "nowrap",
|
|
309
|
+
"width": "100%",
|
|
310
|
+
},
|
|
311
|
+
false,
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
>
|
|
315
|
+
Meisje
|
|
316
|
+
</Text>
|
|
317
|
+
</View>
|
|
318
|
+
<View
|
|
319
|
+
accessible={true}
|
|
320
|
+
collapsable={false}
|
|
321
|
+
focusable={true}
|
|
322
|
+
onBlur={[Function]}
|
|
323
|
+
onClick={[Function]}
|
|
324
|
+
onFocus={[Function]}
|
|
325
|
+
onResponderGrant={[Function]}
|
|
326
|
+
onResponderMove={[Function]}
|
|
327
|
+
onResponderRelease={[Function]}
|
|
328
|
+
onResponderTerminate={[Function]}
|
|
329
|
+
onResponderTerminationRequest={[Function]}
|
|
330
|
+
onStartShouldSetResponder={[Function]}
|
|
331
|
+
style={
|
|
332
|
+
{
|
|
333
|
+
"alignItems": "center",
|
|
334
|
+
"backgroundColor": "transparent",
|
|
335
|
+
"borderRadius": 16,
|
|
336
|
+
"paddingBottom": 8,
|
|
337
|
+
"paddingLeft": 16,
|
|
338
|
+
"paddingRight": 16,
|
|
339
|
+
"paddingTop": 8,
|
|
340
|
+
"width": 0,
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
>
|
|
344
|
+
<Text
|
|
345
|
+
style={
|
|
346
|
+
[
|
|
347
|
+
{
|
|
348
|
+
"color": "#1F2933",
|
|
349
|
+
"fontFamily": "SourceSansPro",
|
|
350
|
+
"fontSize": 16,
|
|
351
|
+
"lineHeight": 22.4,
|
|
352
|
+
"maxHeight": 32,
|
|
353
|
+
"overflow": "hidden",
|
|
354
|
+
"textAlign": "center",
|
|
355
|
+
"textOverflow": "ellipsis",
|
|
356
|
+
"whiteSpace": "nowrap",
|
|
357
|
+
"width": "100%",
|
|
358
|
+
},
|
|
359
|
+
false,
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
>
|
|
363
|
+
Beide
|
|
364
|
+
</Text>
|
|
365
|
+
</View>
|
|
366
|
+
<View
|
|
367
|
+
collapsable={false}
|
|
368
|
+
style={
|
|
369
|
+
{
|
|
370
|
+
"alignItems": "center",
|
|
371
|
+
"backgroundColor": "#647ACB",
|
|
372
|
+
"borderRadius": 16,
|
|
373
|
+
"paddingBottom": 8,
|
|
374
|
+
"paddingLeft": 16,
|
|
375
|
+
"paddingRight": 16,
|
|
376
|
+
"paddingTop": 8,
|
|
377
|
+
"position": "absolute",
|
|
378
|
+
"transform": [
|
|
379
|
+
{
|
|
380
|
+
"translateY": 0,
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
"width": 0,
|
|
384
|
+
"zIndex": -1,
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
>
|
|
388
|
+
<Text
|
|
389
|
+
style={
|
|
390
|
+
[
|
|
391
|
+
{
|
|
392
|
+
"color": "#1F2933",
|
|
393
|
+
"fontFamily": "SourceSansPro",
|
|
394
|
+
"fontSize": 16,
|
|
395
|
+
"lineHeight": 22.4,
|
|
396
|
+
"maxHeight": 32,
|
|
397
|
+
"overflow": "hidden",
|
|
398
|
+
"textAlign": "center",
|
|
399
|
+
"textOverflow": "ellipsis",
|
|
400
|
+
"whiteSpace": "nowrap",
|
|
401
|
+
"width": "100%",
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"opacity": 0,
|
|
405
|
+
},
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
>
|
|
409
|
+
Hidden dsfdslflsd lfdslf lsdlfdslf lsdfl sdfl sfdl sdfl dsfl
|
|
410
|
+
</Text>
|
|
411
|
+
</View>
|
|
412
|
+
</View>
|
|
413
|
+
</View>
|
|
414
|
+
</View>
|
|
415
|
+
`;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, {useContext, useState} from 'react';
|
|
2
|
+
import {Animated, Pressable, Text, View} from 'react-native';
|
|
3
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
|
+
import {Stylesheet} from './filter-tab.styles';
|
|
5
|
+
|
|
6
|
+
type FilterTab = {
|
|
7
|
+
tabItem: {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const FilterTab = ({tabItem}: FilterTab) => {
|
|
14
|
+
const [dimensions, setDimensions] = useState({width: 0, height: 0});
|
|
15
|
+
const [translateValue] = useState(new Animated.Value(0));
|
|
16
|
+
|
|
17
|
+
const [clickedButton, setClickedButton] = useState(0);
|
|
18
|
+
const [isActive, setIsActive] = useState(false);
|
|
19
|
+
|
|
20
|
+
// Default from design.
|
|
21
|
+
const minTabWidth = 95;
|
|
22
|
+
|
|
23
|
+
const elementWidth = dimensions.width;
|
|
24
|
+
const inRow = elementWidth > minTabWidth * tabItem.length;
|
|
25
|
+
const itemWidth = inRow ? dimensions.width / tabItem.length : elementWidth;
|
|
26
|
+
|
|
27
|
+
const translateTab = (index: number, inRow: boolean) => {
|
|
28
|
+
const formula = inRow
|
|
29
|
+
? index * (dimensions.width / tabItem.length)
|
|
30
|
+
: index * (dimensions.height / tabItem.length);
|
|
31
|
+
|
|
32
|
+
Animated.spring(translateValue, {
|
|
33
|
+
toValue: formula,
|
|
34
|
+
useNativeDriver: true,
|
|
35
|
+
}).start();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const context = useContext(ThemeCtx);
|
|
39
|
+
const styles = Stylesheet(context, inRow, elementWidth, itemWidth);
|
|
40
|
+
|
|
41
|
+
const renderTabs = (inRow: boolean) => {
|
|
42
|
+
const trans = inRow
|
|
43
|
+
? {transform: [{translateX: translateValue}]}
|
|
44
|
+
: {transform: [{translateY: translateValue}]};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View style={styles.tabs}>
|
|
48
|
+
{tabItem.map((tab, index) => (
|
|
49
|
+
<Pressable
|
|
50
|
+
key={index}
|
|
51
|
+
style={styles.tab}
|
|
52
|
+
onPress={() => {
|
|
53
|
+
setClickedButton(index);
|
|
54
|
+
setIsActive(!isActive);
|
|
55
|
+
translateTab(index, inRow);
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Text
|
|
59
|
+
style={[
|
|
60
|
+
styles.text,
|
|
61
|
+
clickedButton === index && styles.tabTextActive,
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
{tab.label}
|
|
65
|
+
</Text>
|
|
66
|
+
</Pressable>
|
|
67
|
+
))}
|
|
68
|
+
<Animated.View style={[styles.tab, styles.slidingTab, trans]}>
|
|
69
|
+
<Text style={[styles.text, styles.textHidden]}>
|
|
70
|
+
Hidden dsfdslflsd lfdslf lsdlfdslf lsdfl sdfl sfdl sdfl dsfl
|
|
71
|
+
</Text>
|
|
72
|
+
</Animated.View>
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View style={styles.container}>
|
|
79
|
+
<View
|
|
80
|
+
style={styles.inner}
|
|
81
|
+
onLayout={(event) => {
|
|
82
|
+
const {width, height} = event.nativeEvent.layout;
|
|
83
|
+
setDimensions({
|
|
84
|
+
width: width,
|
|
85
|
+
height: height,
|
|
86
|
+
});
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{renderTabs(inRow)}
|
|
90
|
+
</View>
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FilterTab} from './filter-tab.component';
|
|
3
|
+
import {useWindowDimensions} from 'react-native';
|
|
4
|
+
const {View} = require('react-native');
|
|
5
|
+
|
|
6
|
+
export const FilterTabPreview = ({}: {}) => {
|
|
7
|
+
const tabs = [
|
|
8
|
+
{
|
|
9
|
+
value: 'M',
|
|
10
|
+
label: 'Jongen',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: 'V',
|
|
14
|
+
label: 'Meisje',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: 'MV',
|
|
18
|
+
label: 'Beide',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const full = useWindowDimensions();
|
|
23
|
+
const width = full.width;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View
|
|
27
|
+
style={{
|
|
28
|
+
borderColor: 'red',
|
|
29
|
+
borderStyle: 'solid',
|
|
30
|
+
borderWidth: 1,
|
|
31
|
+
width: width - 30,
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<FilterTab tabItem={tabs} />
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Font} from '../../../theme/font';
|
|
3
|
+
import {Scale} from '../../../theme/scale';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
paddingRight: Scale.xxs,
|
|
11
|
+
paddingLeft: Scale.xxs,
|
|
12
|
+
paddingTop: Scale.xxs,
|
|
13
|
+
paddingBottom: Scale.xxs,
|
|
14
|
+
borderRadius: 16,
|
|
15
|
+
backgroundColor: Context.colors.ui.lightgrey,
|
|
16
|
+
},
|
|
17
|
+
inner: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
width: '100%',
|
|
20
|
+
},
|
|
21
|
+
tabs: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: inRow ? 'row' : 'column',
|
|
24
|
+
width: '100%',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
},
|
|
27
|
+
tab: {
|
|
28
|
+
width: ItemWidth,
|
|
29
|
+
paddingRight: Scale.m,
|
|
30
|
+
paddingLeft: Scale.m,
|
|
31
|
+
paddingTop: Scale.xs,
|
|
32
|
+
paddingBottom: Scale.xs,
|
|
33
|
+
borderRadius: 16,
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
},
|
|
37
|
+
slidingTab: {
|
|
38
|
+
width: ItemWidth,
|
|
39
|
+
paddingRight: Scale.m,
|
|
40
|
+
paddingLeft: Scale.m,
|
|
41
|
+
paddingTop: Scale.xs,
|
|
42
|
+
paddingBottom: Scale.xs,
|
|
43
|
+
borderRadius: 16,
|
|
44
|
+
zIndex: -1,
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
backgroundColor: Context.colors.main['5'],
|
|
47
|
+
},
|
|
48
|
+
textHidden: {
|
|
49
|
+
opacity: 0,
|
|
50
|
+
},
|
|
51
|
+
text: {
|
|
52
|
+
...Font.medium,
|
|
53
|
+
width: '100%',
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
color: Context.colors.ui.black,
|
|
56
|
+
maxHeight: 32,
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
whiteSpace: 'nowrap',
|
|
59
|
+
textOverflow: 'ellipsis',
|
|
60
|
+
},
|
|
61
|
+
tabTextActive: {
|
|
62
|
+
color: Context.colors.ui.white,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {FilterTab} from './filter-tab.component';
|
|
4
|
+
|
|
5
|
+
describe('Filter tab test', () => {
|
|
6
|
+
it('renders a filter tab with 2 tabs', function () {
|
|
7
|
+
const tabs1 = [
|
|
8
|
+
{
|
|
9
|
+
value: 'QR',
|
|
10
|
+
label: 'QR-Code',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: 'NFC',
|
|
14
|
+
label: 'NFC',
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
const tree = render.create(<FilterTab tabItem={tabs1} />).toJSON();
|
|
18
|
+
expect(tree).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
it('renders a filter tab with 3 tabs', function () {
|
|
21
|
+
const tabs2 = [
|
|
22
|
+
{
|
|
23
|
+
value: 'M',
|
|
24
|
+
label: 'Jongen',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: 'V',
|
|
28
|
+
label: 'Meisje',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: 'MV',
|
|
32
|
+
label: 'Beide',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const tree = render.create(<FilterTab tabItem={tabs2} />).toJSON();
|
|
36
|
+
expect(tree).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|