@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.
Files changed (220) hide show
  1. package/.expo-shared/assets.json +4 -0
  2. package/.github/workflows/run-tests.yml +16 -0
  3. package/.prettierrc.js +9 -0
  4. package/.yarnrc.yml +1 -0
  5. package/App.tsx +221 -0
  6. package/app.json +33 -0
  7. package/assets/adaptive-icon.png +0 -0
  8. package/assets/components/avatar/baby.png +0 -0
  9. package/assets/favicon.png +0 -0
  10. package/assets/fonts/montserrat/bold.ttf +0 -0
  11. package/assets/fonts/montserrat/regular.ttf +0 -0
  12. package/assets/fonts/source-sans-pro/bold.ttf +0 -0
  13. package/assets/fonts/source-sans-pro/regular.ttf +0 -0
  14. package/assets/icon.png +0 -0
  15. package/assets/splash.png +0 -0
  16. package/babel.config.js +6 -0
  17. package/jest.config.js +22 -0
  18. package/package.json +53 -0
  19. package/src/components/atoms/avatar/__snapshots__/avatar.test.js.snap +85 -0
  20. package/src/components/atoms/avatar/avatar.component.tsx +35 -0
  21. package/src/components/atoms/avatar/avatar.preview.tsx +38 -0
  22. package/src/components/atoms/avatar/avatar.styles.js +55 -0
  23. package/src/components/atoms/avatar/avatar.test.js +22 -0
  24. package/src/components/atoms/button/__snapshots__/button.test.js.snap +307 -0
  25. package/src/components/atoms/button/button.component.tsx +27 -0
  26. package/src/components/atoms/button/button.preview.tsx +34 -0
  27. package/src/components/atoms/button/button.styles.js +25 -0
  28. package/src/components/atoms/button/button.test.js +35 -0
  29. package/src/components/atoms/cancel-link/__snapshots__/cancel-link.test.js.snap +89 -0
  30. package/src/components/atoms/cancel-link/cancel-link.component.tsx +24 -0
  31. package/src/components/atoms/cancel-link/cancel-link.preview.tsx +20 -0
  32. package/src/components/atoms/cancel-link/cancel-link.styles.js +20 -0
  33. package/src/components/atoms/cancel-link/cancel-link.test.js +28 -0
  34. package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +67 -0
  35. package/src/components/atoms/check-switch/check-switch.component.tsx +46 -0
  36. package/src/components/atoms/check-switch/check-switch.preview.tsx +31 -0
  37. package/src/components/atoms/check-switch/check-switch.styles.js +36 -0
  38. package/src/components/atoms/check-switch/check-switch.test.js +13 -0
  39. package/src/components/atoms/checkbox/__snapshots__/checkbox.test.js.snap +120 -0
  40. package/src/components/atoms/checkbox/checkbox.component.tsx +26 -0
  41. package/src/components/atoms/checkbox/checkbox.preview.tsx +46 -0
  42. package/src/components/atoms/checkbox/checkbox.styles.js +35 -0
  43. package/src/components/atoms/checkbox/checkbox.test.js +30 -0
  44. package/src/components/atoms/child-list-item/__snapshots__/child-list-item.test.js.snap +635 -0
  45. package/src/components/atoms/child-list-item/child-list-item.component.tsx +81 -0
  46. package/src/components/atoms/child-list-item/child-list-item.preview.tsx +65 -0
  47. package/src/components/atoms/child-list-item/child-list-item.styles.js +82 -0
  48. package/src/components/atoms/child-list-item/child-list-item.test.js +73 -0
  49. package/src/components/atoms/contact-item/__snapshots__/contact-item.test.js.snap +321 -0
  50. package/src/components/atoms/contact-item/contact-item.component.tsx +61 -0
  51. package/src/components/atoms/contact-item/contact-item.preview.tsx +30 -0
  52. package/src/components/atoms/contact-item/contact-item.styles.js +26 -0
  53. package/src/components/atoms/contact-item/contact-item.test.js +20 -0
  54. package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +415 -0
  55. package/src/components/atoms/filter-tab/filter-tab.component.tsx +93 -0
  56. package/src/components/atoms/filter-tab/filter-tab.preview.tsx +37 -0
  57. package/src/components/atoms/filter-tab/filter-tab.styles.js +64 -0
  58. package/src/components/atoms/filter-tab/filter-tab.test.js +38 -0
  59. package/src/components/atoms/form-actions/__snapshots__/form-action.test.js.snap +176 -0
  60. package/src/components/atoms/form-actions/form-action.component.tsx +25 -0
  61. package/src/components/atoms/form-actions/form-action.preview.tsx +29 -0
  62. package/src/components/atoms/form-actions/form-action.styles.js +19 -0
  63. package/src/components/atoms/form-actions/form-action.test.js +32 -0
  64. package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +67 -0
  65. package/src/components/atoms/image-bubble/image-bubble.component.tsx +25 -0
  66. package/src/components/atoms/image-bubble/image-bubble.preview.tsx +19 -0
  67. package/src/components/atoms/image-bubble/image-bubble.styles.js +31 -0
  68. package/src/components/atoms/image-bubble/image-bubble.test.js +20 -0
  69. package/src/components/atoms/info/__snapshots__/info.test.js.snap +43 -0
  70. package/src/components/atoms/info/info.component.tsx +22 -0
  71. package/src/components/atoms/info/info.preview.tsx +20 -0
  72. package/src/components/atoms/info/info.styles.js +25 -0
  73. package/src/components/atoms/info/info.test.js +18 -0
  74. package/src/components/atoms/pill/__snapshots__/pill.test.js.snap +141 -0
  75. package/src/components/atoms/pill/pill.component.tsx +23 -0
  76. package/src/components/atoms/pill/pill.preview.tsx +21 -0
  77. package/src/components/atoms/pill/pill.styles.js +32 -0
  78. package/src/components/atoms/pill/pill.test.js +34 -0
  79. package/src/components/atoms/popover/components/backdrop/backdrop.component.tsx +40 -0
  80. package/src/components/atoms/popover/components/backdrop/backdrop.styles.js +15 -0
  81. package/src/components/atoms/popover/components/foreground/foreground.component.tsx +17 -0
  82. package/src/components/atoms/popover/components/foreground/foreground.styles.js +17 -0
  83. package/src/components/atoms/popover/components/index.js +5 -0
  84. package/src/components/atoms/popover/components/modal/close/close.component.tsx +21 -0
  85. package/src/components/atoms/popover/components/modal/close/close.styles.js +13 -0
  86. package/src/components/atoms/popover/components/modal/heading/heading.component.tsx +22 -0
  87. package/src/components/atoms/popover/components/modal/heading/heading.styles.js +24 -0
  88. package/src/components/atoms/popover/components/modal/modal.component.tsx +87 -0
  89. package/src/components/atoms/popover/components/modal/modal.styles.js +23 -0
  90. package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.tsx +18 -0
  91. package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.styles.js +10 -0
  92. package/src/components/atoms/popover/popover.component.tsx +60 -0
  93. package/src/components/atoms/popover/popover.preview.tsx +135 -0
  94. package/src/components/atoms/popover/popover.styles.js +12 -0
  95. package/src/components/atoms/popover-heading/__snapshots__/popover_heading.test.js.snap +35 -0
  96. package/src/components/atoms/popover-heading/popover-heading.component.tsx +22 -0
  97. package/src/components/atoms/popover-heading/popover-heading.preview.tsx +18 -0
  98. package/src/components/atoms/popover-heading/popover-heading.styles.js +19 -0
  99. package/src/components/atoms/popover-heading/popover_heading.test.js +11 -0
  100. package/src/components/atoms/pressable-icon/__snapshots__/pressable-icon.test.js.snap +364 -0
  101. package/src/components/atoms/pressable-icon/pressable-icon.component.tsx +48 -0
  102. package/src/components/atoms/pressable-icon/pressable-icon.preview.tsx +37 -0
  103. package/src/components/atoms/pressable-icon/pressable-icon.styles.js +25 -0
  104. package/src/components/atoms/pressable-icon/pressable-icon.test.js +47 -0
  105. package/src/components/atoms/quick-filter/__snapshots__/quick-filter.test.js.snap +465 -0
  106. package/src/components/atoms/quick-filter/quick-filter.component.tsx +32 -0
  107. package/src/components/atoms/quick-filter/quick-filter.prevriew.tsx +46 -0
  108. package/src/components/atoms/quick-filter/quick-filter.styles.js +68 -0
  109. package/src/components/atoms/quick-filter/quick-filter.test.js +127 -0
  110. package/src/components/atoms/select-list-item/__snapshots__/select-list-item.test.js.snap +391 -0
  111. package/src/components/atoms/select-list-item/select-list-item-preview.tsx +31 -0
  112. package/src/components/atoms/select-list-item/select-list-item.test.js +38 -0
  113. package/src/components/atoms/select-list-item/select-list.component-item.tsx +52 -0
  114. package/src/components/atoms/select-list-item/select-list.styles-item.js +40 -0
  115. package/src/components/atoms/snackbar/__snapshots__/snackbar.test.js.snap +493 -0
  116. package/src/components/atoms/snackbar/snackbar.component.tsx +28 -0
  117. package/src/components/atoms/snackbar/snackbar.preview.tsx +33 -0
  118. package/src/components/atoms/snackbar/snackbar.styles.js +82 -0
  119. package/src/components/atoms/snackbar/snackbar.test.js +35 -0
  120. package/src/components/atoms/tag/__snapshots__/tag.test.js.snap +87 -0
  121. package/src/components/atoms/tag/tag.component.tsx +37 -0
  122. package/src/components/atoms/tag/tag.preview.tsx +27 -0
  123. package/src/components/atoms/tag/tag.styles.js +22 -0
  124. package/src/components/atoms/tag/tag.test.js +24 -0
  125. package/src/components/atoms/text-bubble/__snapshots__/text-bubble.test.js.snap +337 -0
  126. package/src/components/atoms/text-bubble/text-bubble.component.tsx +32 -0
  127. package/src/components/atoms/text-bubble/text-bubble.preview.tsx +27 -0
  128. package/src/components/atoms/text-bubble/text-bubble.styles.js +64 -0
  129. package/src/components/atoms/text-bubble/text-bubble.test.js +84 -0
  130. package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +68 -0
  131. package/src/components/atoms/text-input/text-input.component.tsx +32 -0
  132. package/src/components/atoms/text-input/text-input.preview.tsx +24 -0
  133. package/src/components/atoms/text-input/text-input.styles.js +26 -0
  134. package/src/components/atoms/text-input/text-input.test.js +32 -0
  135. package/src/components/atoms/time-tracker/__snapshots__/time-tracker.test.js.snap +206 -0
  136. package/src/components/atoms/time-tracker/time-tracker.component.tsx +24 -0
  137. package/src/components/atoms/time-tracker/time-tracker.preview.tsx +15 -0
  138. package/src/components/atoms/time-tracker/time-tracker.styles.js +36 -0
  139. package/src/components/atoms/time-tracker/time-tracker.test.js +37 -0
  140. package/src/components/atoms/wide-button/__snapshots__/wide-button.test.js.snap +92 -0
  141. package/src/components/atoms/wide-button/wide-button.component.tsx +23 -0
  142. package/src/components/atoms/wide-button/wide-button.preview.tsx +18 -0
  143. package/src/components/atoms/wide-button/wide-button.styles.js +22 -0
  144. package/src/components/atoms/wide-button/wide-button.test.js +16 -0
  145. package/src/context/theme.context.ts +49 -0
  146. package/src/gradients/main/main.gradient.tsx +20 -0
  147. package/src/gradients/main/main.styles.js +11 -0
  148. package/src/icons/__snapshots__/icons.test.js.snap +2588 -0
  149. package/src/icons/icons.test.js +245 -0
  150. package/src/icons/index.tsx +7 -0
  151. package/src/icons/outline/calendar/calendar.icon.tsx +20 -0
  152. package/src/icons/outline/chat/chat.icon.tsx +20 -0
  153. package/src/icons/outline/chat-alt/chat-alt.icon.tsx +20 -0
  154. package/src/icons/outline/check-circle/check-circle.icon.tsx +20 -0
  155. package/src/icons/outline/chevron-left/chevron-left.icon.tsx +20 -0
  156. package/src/icons/outline/chevron-right/chevron-right.icon.tsx +20 -0
  157. package/src/icons/outline/clock/clock.icon.tsx +20 -0
  158. package/src/icons/outline/cloud-download/cloud-download.icon.tsx +20 -0
  159. package/src/icons/outline/cross/cross.icon.tsx +20 -0
  160. package/src/icons/outline/currency-euro/currency-euro.icon.tsx +20 -0
  161. package/src/icons/outline/document-text/document-text.icon.tsx +20 -0
  162. package/src/icons/outline/exclamation/exclamation.icon.tsx +20 -0
  163. package/src/icons/outline/exclamation-circle/exclamation-circle.icon.tsx +20 -0
  164. package/src/icons/outline/eye/eye.icon.tsx +27 -0
  165. package/src/icons/outline/filter/filter.icon.tsx +59 -0
  166. package/src/icons/outline/information-circle/information-circle.icon.tsx +20 -0
  167. package/src/icons/outline/logout/logout.icon.tsx +20 -0
  168. package/src/icons/outline/mail/mail.icon.tsx +20 -0
  169. package/src/icons/outline/mail-open/mail-open.icon.tsx +20 -0
  170. package/src/icons/outline/menu/menu.icon.tsx +20 -0
  171. package/src/icons/outline/minus-sm/minus-sm.icon.tsx +20 -0
  172. package/src/icons/outline/office-building/office-building.icon.tsx +20 -0
  173. package/src/icons/outline/outline-default.preview.tsx +99 -0
  174. package/src/icons/outline/outline-grey.preview.tsx +100 -0
  175. package/src/icons/outline/outline-white.preview.tsx +100 -0
  176. package/src/icons/outline/outline.tsx +81 -0
  177. package/src/icons/outline/paper-airplane/paper-airplane.icon.tsx +20 -0
  178. package/src/icons/outline/paperclip/paperclip.icon.tsx +20 -0
  179. package/src/icons/outline/pencil/pencil.icon.tsx +20 -0
  180. package/src/icons/outline/phone/phone.icon.tsx +20 -0
  181. package/src/icons/outline/plus/plus.icon.tsx +20 -0
  182. package/src/icons/outline/plus-sm/plus-sm.icon.tsx +20 -0
  183. package/src/icons/outline/qrcode/qrcode.icon.tsx +17 -0
  184. package/src/icons/outline/refresh/refresh.icon.tsx +20 -0
  185. package/src/icons/outline/search/search.icon.tsx +20 -0
  186. package/src/icons/outline/selector/selector.icon.tsx +20 -0
  187. package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.tsx +20 -0
  188. package/src/icons/outline/status-online/status-online.icon.tsx +20 -0
  189. package/src/icons/outline/thumb-up/thumb-up.icon.tsx +20 -0
  190. package/src/icons/outline/trash/trash.icon.tsx +20 -0
  191. package/src/icons/outline/user/user.icon.tsx +27 -0
  192. package/src/icons/outline/user-group/user-group.icon.tsx +20 -0
  193. package/src/icons/outline/users/users.icon.tsx +20 -0
  194. package/src/icons/solid/chat-alt/chat-alt-solid.icon.tsx +20 -0
  195. package/src/icons/solid/clock/clock-solid.icon.tsx +20 -0
  196. package/src/icons/solid/information-circle/information-circle-solid.icon.tsx +20 -0
  197. package/src/icons/solid/pencil/pencil-solid.icon.tsx +22 -0
  198. package/src/icons/solid/phone/phone-solid.icon.tsx +18 -0
  199. package/src/icons/solid/refresh/refresh-solid.icon.tsx +20 -0
  200. package/src/icons/solid/solid.preview.tsx +73 -0
  201. package/src/icons/solid/solid.tsx +19 -0
  202. package/src/icons/solid/status-online/status-online-solid.icon.tsx +24 -0
  203. package/src/icons/solid/trash/trash-solid.icon.tsx +20 -0
  204. package/src/models/hex-color.model.ts +25 -0
  205. package/src/models/hex-color.test.js +20 -0
  206. package/src/models/initials.model.ts +32 -0
  207. package/src/models/initials.test.js +23 -0
  208. package/src/theme/font/font.ts +72 -0
  209. package/src/theme/font/index.ts +4 -0
  210. package/src/theme/font/load-fonts.ts +10 -0
  211. package/src/theme/provider/index.ts +4 -0
  212. package/src/theme/provider/parent.theme.ts +45 -0
  213. package/src/theme/provider/staff-member.theme.ts +45 -0
  214. package/src/theme/scale/index.ts +14 -0
  215. package/src/types/bubble-alignment.enum.ts +4 -0
  216. package/src/types/icontype.type.ts +3 -0
  217. package/src/types/keyboard-types.enum.ts +9 -0
  218. package/src/types/size.enum.ts +5 -0
  219. package/src/types/visual-state.enum.ts +6 -0
  220. package/tsconfig.json +7 -0
@@ -0,0 +1,87 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test Tag renders Tag correctly (blue, bold grey text) when isSelected is true 1`] = `
4
+ <View
5
+ accessible={true}
6
+ collapsable={false}
7
+ focusable={true}
8
+ onBlur={[Function]}
9
+ onClick={[Function]}
10
+ onFocus={[Function]}
11
+ onResponderGrant={[Function]}
12
+ onResponderMove={[Function]}
13
+ onResponderRelease={[Function]}
14
+ onResponderTerminate={[Function]}
15
+ onResponderTerminationRequest={[Function]}
16
+ onStartShouldSetResponder={[Function]}
17
+ >
18
+ <View
19
+ style={
20
+ {
21
+ "alignItems": "center",
22
+ "backgroundColor": "#E5E8EB",
23
+ "borderRadius": 50,
24
+ "justifyContent": "center",
25
+ "paddingHorizontal": 8,
26
+ "paddingVertical": 8,
27
+ }
28
+ }
29
+ >
30
+ <Text
31
+ style={
32
+ {
33
+ "color": "#1F2933",
34
+ "fontFamily": "Montserrat",
35
+ "fontSize": 13,
36
+ "lineHeight": 20.4,
37
+ }
38
+ }
39
+ >
40
+ Geblokkeerd
41
+ </Text>
42
+ </View>
43
+ </View>
44
+ `;
45
+
46
+ exports[`test Tag renders Tag correctly (grey, black text) 1`] = `
47
+ <View
48
+ accessible={true}
49
+ collapsable={false}
50
+ focusable={true}
51
+ onBlur={[Function]}
52
+ onClick={[Function]}
53
+ onFocus={[Function]}
54
+ onResponderGrant={[Function]}
55
+ onResponderMove={[Function]}
56
+ onResponderRelease={[Function]}
57
+ onResponderTerminate={[Function]}
58
+ onResponderTerminationRequest={[Function]}
59
+ onStartShouldSetResponder={[Function]}
60
+ >
61
+ <View
62
+ style={
63
+ {
64
+ "alignItems": "center",
65
+ "backgroundColor": "#E5E8EB",
66
+ "borderRadius": 50,
67
+ "justifyContent": "center",
68
+ "paddingHorizontal": 8,
69
+ "paddingVertical": 8,
70
+ }
71
+ }
72
+ >
73
+ <Text
74
+ style={
75
+ {
76
+ "color": "#1F2933",
77
+ "fontFamily": "Montserrat",
78
+ "fontSize": 13,
79
+ "lineHeight": 20.4,
80
+ }
81
+ }
82
+ >
83
+ Geblokkeerd
84
+ </Text>
85
+ </View>
86
+ </View>
87
+ `;
@@ -0,0 +1,37 @@
1
+ import React, {useContext, useState} from 'react';
2
+ import {ThemeCtx} from '../../../context/theme.context';
3
+ import {Stylesheet} from './tag.styles';
4
+ import {View, Text, Pressable} from 'react-native';
5
+
6
+ export interface TagPressEvent {
7
+ value: string;
8
+ isSelected: boolean;
9
+ }
10
+
11
+ type TagProps = {
12
+ value: string;
13
+ text: string;
14
+ isSelected?: boolean;
15
+ onPress: (event: TagPressEvent) => void;
16
+ };
17
+
18
+ const Tag = ({text, isSelected, onPress, value}: TagProps) => {
19
+ const context = useContext(ThemeCtx);
20
+ const [isSelectedTag, setIsSelectedTag] = useState(isSelected);
21
+ const styles = Stylesheet(context, isSelectedTag);
22
+
23
+ const onClicked = () => {
24
+ setIsSelectedTag((current) => !current);
25
+ onPress({value, isSelected: !isSelectedTag});
26
+ };
27
+
28
+ return (
29
+ <Pressable onPress={onClicked}>
30
+ <View style={styles.container}>
31
+ <Text style={styles.text}>{text}</Text>
32
+ </View>
33
+ </Pressable>
34
+ );
35
+ };
36
+
37
+ export {Tag as Tag};
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import {Tag, TagPressEvent} from './tag.component';
3
+ import {View} from 'react-native';
4
+
5
+ export const TagPreview = ({}: {}) => {
6
+ return (
7
+ <View>
8
+ <Tag
9
+ value={'tab1'}
10
+ text={'Algemeen'}
11
+ onPress={(e) => console.log('clicked', e)}
12
+ />
13
+ <Tag
14
+ value={'tab2'}
15
+ text={'Gezondheid'}
16
+ isSelected={true}
17
+ onPress={(e) => console.log('clicked', e)}
18
+ />
19
+ <Tag
20
+ value={'tab3'}
21
+ text={'Activiteit'}
22
+ isSelected={true}
23
+ onPress={(e) => console.log('clicked', e)}
24
+ />
25
+ </View>
26
+ );
27
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import {StyleSheet} from 'react-native';
3
+ import {Font} from '../../../theme/font';
4
+ import {Scale} from '../../../theme/scale';
5
+
6
+ export const Stylesheet = (context, isSelected) =>
7
+ StyleSheet.create({
8
+ container: {
9
+ borderRadius: 50,
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ paddingVertical: Scale.xs,
13
+ paddingHorizontal: Scale.xs,
14
+ backgroundColor: isSelected
15
+ ? context.colors.main[5]
16
+ : context.colors.ui.lightgrey,
17
+ },
18
+ text: {
19
+ ...(isSelected ? Font.smallBold : Font.small),
20
+ color: isSelected ? context.colors.main[9] : context.colors.ui.black,
21
+ },
22
+ });
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import {Tag} from './tag.component';
4
+
5
+ describe('test Tag', () => {
6
+ it('renders Tag correctly (grey, black text)', () => {
7
+ const tree = renderer
8
+ .create(
9
+ <Tag text={'Geblokkeerd'} onPress={() => console.log('clicked')} />
10
+ )
11
+ .toJSON();
12
+
13
+ expect(tree).toMatchSnapshot();
14
+ });
15
+ it('renders Tag correctly (blue, bold grey text) when isSelected is true', () => {
16
+ const tree = renderer
17
+ .create(
18
+ <Tag text={'Geblokkeerd'} onPress={() => console.log('clicked')} />
19
+ )
20
+ .toJSON();
21
+
22
+ expect(tree).toMatchSnapshot();
23
+ });
24
+ });
@@ -0,0 +1,337 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test text-bubble given the bubbleAlignment is SENT return a text-bubble with right-bottom tip 1`] = `
4
+ <View>
5
+ <View
6
+ style={
7
+ [
8
+ {
9
+ "borderRadius": 24,
10
+ "borderStyle": "solid",
11
+ "borderWidth": 1,
12
+ "justifyContent": "center",
13
+ "marginTop": 24,
14
+ "maxWidth": "80%",
15
+ "overflow": "hidden",
16
+ "paddingHorizontal": 24,
17
+ "paddingVertical": 16,
18
+ },
19
+ {
20
+ "backgroundColor": "#E0E8F9",
21
+ "borderColor": "#E0E8F9",
22
+ },
23
+ false,
24
+ false,
25
+ false,
26
+ {
27
+ "borderBottomLeftRadius": 32,
28
+ "borderBottomRightRadius": 8,
29
+ "marginLeft": 48,
30
+ "marginRight": 16,
31
+ },
32
+ ]
33
+ }
34
+ >
35
+ <Text
36
+ style={
37
+ [
38
+ {
39
+ "fontFamily": "Montserrat",
40
+ "fontSize": 13,
41
+ "lineHeight": 20.4,
42
+ "paddingHorizontal": 24,
43
+ "paddingVertical": 16,
44
+ },
45
+ false,
46
+ {
47
+ "color": "#19216C",
48
+ },
49
+ false,
50
+ ]
51
+ }
52
+ >
53
+ TEST Bubble
54
+ </Text>
55
+ </View>
56
+ </View>
57
+ `;
58
+
59
+ exports[`test text-bubble given the visualState is DEFAULT return a light-blue colored text-bubble AND dark green text 1`] = `
60
+ <View>
61
+ <View
62
+ style={
63
+ [
64
+ {
65
+ "borderRadius": 24,
66
+ "borderStyle": "solid",
67
+ "borderWidth": 1,
68
+ "justifyContent": "center",
69
+ "marginTop": 24,
70
+ "maxWidth": "80%",
71
+ "overflow": "hidden",
72
+ "paddingHorizontal": 24,
73
+ "paddingVertical": 16,
74
+ },
75
+ {
76
+ "backgroundColor": "#E0E8F9",
77
+ "borderColor": "#E0E8F9",
78
+ },
79
+ false,
80
+ false,
81
+ false,
82
+ {
83
+ "borderBottomLeftRadius": 32,
84
+ "borderBottomRightRadius": 8,
85
+ "marginLeft": 48,
86
+ "marginRight": 16,
87
+ },
88
+ ]
89
+ }
90
+ >
91
+ <Text
92
+ style={
93
+ [
94
+ {
95
+ "fontFamily": "Montserrat",
96
+ "fontSize": 13,
97
+ "lineHeight": 20.4,
98
+ "paddingHorizontal": 24,
99
+ "paddingVertical": 16,
100
+ },
101
+ false,
102
+ {
103
+ "color": "#19216C",
104
+ },
105
+ false,
106
+ ]
107
+ }
108
+ >
109
+ TEST color
110
+ </Text>
111
+ </View>
112
+ </View>
113
+ `;
114
+
115
+ exports[`test text-bubble given the visualState is ERROR return a red colored text-bubble AND white text 1`] = `
116
+ <View>
117
+ <View
118
+ style={
119
+ [
120
+ {
121
+ "borderRadius": 24,
122
+ "borderStyle": "solid",
123
+ "borderWidth": 1,
124
+ "justifyContent": "center",
125
+ "marginTop": 24,
126
+ "maxWidth": "80%",
127
+ "overflow": "hidden",
128
+ "paddingHorizontal": 24,
129
+ "paddingVertical": 16,
130
+ },
131
+ false,
132
+ false,
133
+ {
134
+ "backgroundColor": "#F16868",
135
+ "borderColor": "#F16868",
136
+ },
137
+ false,
138
+ {
139
+ "borderBottomLeftRadius": 32,
140
+ "borderBottomRightRadius": 8,
141
+ "marginLeft": 48,
142
+ "marginRight": 16,
143
+ },
144
+ ]
145
+ }
146
+ >
147
+ <Text
148
+ style={
149
+ [
150
+ {
151
+ "fontFamily": "Montserrat",
152
+ "fontSize": 13,
153
+ "lineHeight": 20.4,
154
+ "paddingHorizontal": 24,
155
+ "paddingVertical": 16,
156
+ },
157
+ {
158
+ "color": "#FFFFFF",
159
+ },
160
+ false,
161
+ false,
162
+ ]
163
+ }
164
+ >
165
+ TEST color
166
+ </Text>
167
+ </View>
168
+ </View>
169
+ `;
170
+
171
+ exports[`test text-bubble given the visualState is RECEIVE return a text-bubble with left-bottom tip 1`] = `
172
+ <View>
173
+ <View
174
+ style={
175
+ [
176
+ {
177
+ "borderRadius": 24,
178
+ "borderStyle": "solid",
179
+ "borderWidth": 1,
180
+ "justifyContent": "center",
181
+ "marginTop": 24,
182
+ "maxWidth": "80%",
183
+ "overflow": "hidden",
184
+ "paddingHorizontal": 24,
185
+ "paddingVertical": 16,
186
+ },
187
+ {
188
+ "backgroundColor": "#E0E8F9",
189
+ "borderColor": "#E0E8F9",
190
+ },
191
+ false,
192
+ false,
193
+ {
194
+ "borderBottomLeftRadius": 8,
195
+ "borderBottomRightRadius": 32,
196
+ "marginLeft": 16,
197
+ "marginRight": 48,
198
+ },
199
+ false,
200
+ ]
201
+ }
202
+ >
203
+ <Text
204
+ style={
205
+ [
206
+ {
207
+ "fontFamily": "Montserrat",
208
+ "fontSize": 13,
209
+ "lineHeight": 20.4,
210
+ "paddingHorizontal": 24,
211
+ "paddingVertical": 16,
212
+ },
213
+ false,
214
+ {
215
+ "color": "#19216C",
216
+ },
217
+ false,
218
+ ]
219
+ }
220
+ >
221
+ TEST Bubble
222
+ </Text>
223
+ </View>
224
+ </View>
225
+ `;
226
+
227
+ exports[`test text-bubble given the visualState is RECEIVE return a textBubble with left-bottom tip 1`] = `
228
+ <View>
229
+ <View
230
+ style={
231
+ [
232
+ {
233
+ "borderRadius": 24,
234
+ "borderStyle": "solid",
235
+ "borderWidth": 1,
236
+ "justifyContent": "center",
237
+ "marginTop": 24,
238
+ "maxWidth": "80%",
239
+ "overflow": "hidden",
240
+ "paddingHorizontal": 24,
241
+ "paddingVertical": 16,
242
+ },
243
+ {
244
+ "backgroundColor": "#E0E8F9",
245
+ "borderColor": "#E0E8F9",
246
+ },
247
+ false,
248
+ false,
249
+ {
250
+ "borderBottomLeftRadius": 8,
251
+ "borderBottomRightRadius": 32,
252
+ "marginLeft": 16,
253
+ "marginRight": 48,
254
+ },
255
+ false,
256
+ ]
257
+ }
258
+ >
259
+ <Text
260
+ style={
261
+ [
262
+ {
263
+ "fontFamily": "Montserrat",
264
+ "fontSize": 13,
265
+ "lineHeight": 20.4,
266
+ "paddingHorizontal": 24,
267
+ "paddingVertical": 16,
268
+ },
269
+ false,
270
+ {
271
+ "color": "#19216C",
272
+ },
273
+ false,
274
+ ]
275
+ }
276
+ >
277
+ TEST Bubble
278
+ </Text>
279
+ </View>
280
+ </View>
281
+ `;
282
+
283
+ exports[`test text-bubble given the visualState is WARNING return an orange colored text-bubble AND white text 1`] = `
284
+ <View>
285
+ <View
286
+ style={
287
+ [
288
+ {
289
+ "borderRadius": 24,
290
+ "borderStyle": "solid",
291
+ "borderWidth": 1,
292
+ "justifyContent": "center",
293
+ "marginTop": 24,
294
+ "maxWidth": "80%",
295
+ "overflow": "hidden",
296
+ "paddingHorizontal": 24,
297
+ "paddingVertical": 16,
298
+ },
299
+ false,
300
+ {
301
+ "backgroundColor": "#FEEFDB",
302
+ "borderColor": "#FEEFDB",
303
+ },
304
+ false,
305
+ false,
306
+ {
307
+ "borderBottomLeftRadius": 32,
308
+ "borderBottomRightRadius": 8,
309
+ "marginLeft": 48,
310
+ "marginRight": 16,
311
+ },
312
+ ]
313
+ }
314
+ >
315
+ <Text
316
+ style={
317
+ [
318
+ {
319
+ "fontFamily": "Montserrat",
320
+ "fontSize": 13,
321
+ "lineHeight": 20.4,
322
+ "paddingHorizontal": 24,
323
+ "paddingVertical": 16,
324
+ },
325
+ false,
326
+ false,
327
+ {
328
+ "color": "#FAAC44",
329
+ },
330
+ ]
331
+ }
332
+ >
333
+ TEST color
334
+ </Text>
335
+ </View>
336
+ </View>
337
+ `;
@@ -0,0 +1,32 @@
1
+ import React, {useContext} from 'react';
2
+ import {View, Text} from 'react-native';
3
+ import {ThemeCtx} from '../../../context/theme.context';
4
+
5
+ import {Stylesheet} from './text-bubble.styles';
6
+ import {VisualState} from '../../../types/visual-state.enum';
7
+ import {BubbleAlignment} from '../../../types/bubble-alignment.enum';
8
+
9
+ type TextBubbleProps = {
10
+ text: string;
11
+ visualState: VisualState;
12
+ bubbleAlignment: BubbleAlignment;
13
+ };
14
+
15
+ const TextBubble: React.FC<TextBubbleProps> = ({
16
+ text,
17
+ visualState,
18
+ bubbleAlignment,
19
+ }) => {
20
+ const context = useContext(ThemeCtx);
21
+ const styles = Stylesheet(context, visualState, bubbleAlignment);
22
+
23
+ return (
24
+ <View>
25
+ <View style={styles.container}>
26
+ <Text style={styles.text}>{text}</Text>
27
+ </View>
28
+ </View>
29
+ );
30
+ };
31
+
32
+ export {TextBubble as TextBubble};
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import {VisualState} from '../../../types/visual-state.enum';
3
+ import {TextBubble} from './text-bubble.component';
4
+ import {BubbleAlignment} from '../../../types/bubble-alignment.enum';
5
+ const {View} = require('react-native');
6
+
7
+ export const TextBubblePreview = ({}: {}) => {
8
+ return (
9
+ <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
10
+ <TextBubble
11
+ text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam suscipit velit in nibh varius, quis accumsan tellus maximus. Aliquam ut massa ullamcorper, vulputate enim at, dignissim felis."
12
+ bubbleAlignment={BubbleAlignment.SENT}
13
+ visualState={VisualState.DEFAULT}
14
+ />
15
+ <TextBubble
16
+ text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam suscipit velit in nibh varius, quis accumsan tellus maximus. Aliquam ut massa ullamcorper, vulputate enim at, dignissim felis."
17
+ bubbleAlignment={BubbleAlignment.RECEIVE}
18
+ visualState={VisualState.WARNING}
19
+ />
20
+ <TextBubble
21
+ text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam suscipit velit in nibh varius, quis accumsan tellus maximus. Aliquam ut massa ullamcorper, vulputate enim at, dignissim felis."
22
+ bubbleAlignment={BubbleAlignment.SENT}
23
+ visualState={VisualState.ERROR}
24
+ />
25
+ </View>
26
+ );
27
+ };
@@ -0,0 +1,64 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ import {VisualState} from '../../../types/visual-state.enum';
4
+ import {BubbleAlignment} from '../../../types/bubble-alignment.enum';
5
+ import {Font} from '../../../theme/font';
6
+ import {Scale} from '../../../theme/scale';
7
+
8
+ export const Stylesheet = (context, visualState, bubbleAlignment) =>
9
+ StyleSheet.create({
10
+ container: [
11
+ {
12
+ maxWidth: '80%',
13
+ paddingVertical: Scale.m,
14
+ paddingHorizontal: Scale.l,
15
+ marginTop: Scale.l,
16
+ borderRadius: Scale.l,
17
+ overflow: 'hidden',
18
+ justifyContent: 'center',
19
+ borderWidth: 1,
20
+ borderStyle: 'solid',
21
+ },
22
+ visualState === VisualState.DEFAULT && {
23
+ backgroundColor: context.colors.main['9'],
24
+ borderColor: context.colors.main['9'],
25
+ },
26
+ visualState === VisualState.WARNING && {
27
+ backgroundColor: context.colors.ui.warning.xlight,
28
+ borderColor: context.colors.ui.warning.xlight,
29
+ },
30
+ visualState === VisualState.ERROR && {
31
+ backgroundColor: context.colors.ui.error.default,
32
+ borderColor: context.colors.ui.error.default,
33
+ },
34
+ bubbleAlignment === BubbleAlignment.RECEIVE && {
35
+ borderBottomLeftRadius: Scale.xs,
36
+ borderBottomRightRadius: Scale.xl,
37
+ marginRight: Scale.xxl,
38
+ marginLeft: Scale.m,
39
+ },
40
+ bubbleAlignment === BubbleAlignment.SENT && {
41
+ borderBottomRightRadius: Scale.xs,
42
+ borderBottomLeftRadius: Scale.xl,
43
+ marginLeft: Scale.xxl,
44
+ marginRight: Scale.m,
45
+ },
46
+ ],
47
+
48
+ text: [
49
+ {
50
+ ...Font.small,
51
+ paddingVertical: 16,
52
+ paddingHorizontal: 24,
53
+ },
54
+ visualState === VisualState.ERROR && {
55
+ color: context.colors.ui.white,
56
+ },
57
+ visualState === VisualState.DEFAULT && {
58
+ color: context.colors.main['0'],
59
+ },
60
+ visualState === VisualState.WARNING && {
61
+ color: context.colors.ui.warning.dark,
62
+ },
63
+ ],
64
+ });