@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,84 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import {TextBubble} from './text-bubble.component';
4
+
5
+ describe('test text-bubble', () => {
6
+ it('given the visualState is ERROR return a red colored text-bubble AND white text', () => {
7
+ const tree = renderer
8
+ .create(
9
+ <TextBubble
10
+ visualState="ERROR"
11
+ bubbleAlignment="SENT"
12
+ text="TEST color"
13
+ />
14
+ )
15
+ .toJSON();
16
+
17
+ expect(tree).toMatchSnapshot();
18
+ });
19
+ it('given the visualState is WARNING return an orange colored text-bubble AND white text', () => {
20
+ const tree = renderer
21
+ .create(
22
+ <TextBubble
23
+ visualState="WARNING"
24
+ bubbleAlignment="SENT"
25
+ text="TEST color"
26
+ />
27
+ )
28
+ .toJSON();
29
+
30
+ expect(tree).toMatchSnapshot();
31
+ });
32
+ it('given the visualState is DEFAULT return a light-blue colored text-bubble AND dark green text', () => {
33
+ const tree = renderer
34
+ .create(
35
+ <TextBubble
36
+ visualState="DEFAULT"
37
+ bubbleAlignment="SENT"
38
+ text="TEST color"
39
+ />
40
+ )
41
+ .toJSON();
42
+
43
+ expect(tree).toMatchSnapshot();
44
+ });
45
+ it('given the bubbleAlignment is SENT return a text-bubble with right-bottom tip', () => {
46
+ const tree = renderer
47
+ .create(
48
+ <TextBubble
49
+ visualState="DEFAULT"
50
+ bubbleAlignment="SENT"
51
+ text="TEST Bubble"
52
+ />
53
+ )
54
+ .toJSON();
55
+
56
+ expect(tree).toMatchSnapshot();
57
+ });
58
+ it('given the visualState is RECEIVE return a text-bubble with left-bottom tip', () => {
59
+ const tree = renderer
60
+ .create(
61
+ <TextBubble
62
+ visualState="DEFAULT"
63
+ bubbleAlignment="RECEIVE"
64
+ text="TEST Bubble"
65
+ />
66
+ )
67
+ .toJSON();
68
+
69
+ expect(tree).toMatchSnapshot();
70
+ });
71
+ it('given the visualState is RECEIVE return a textBubble with left-bottom tip', () => {
72
+ const tree = renderer
73
+ .create(
74
+ <TextBubble
75
+ visualState="DEFAULT"
76
+ bubbleAlignment="RECEIVE"
77
+ text="TEST Bubble"
78
+ />
79
+ )
80
+ .toJSON();
81
+
82
+ expect(tree).toMatchSnapshot();
83
+ });
84
+ });
@@ -0,0 +1,68 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test input texts shows icon when provided 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "backgroundColor": "#FFFFFF",
8
+ "borderColor": "#E5E8EB",
9
+ "borderRadius": 8,
10
+ "borderStyle": "solid",
11
+ "borderWidth": 1,
12
+ "flexDirection": "row",
13
+ "overflow": "hidden",
14
+ "paddingBottom": 8,
15
+ "paddingLeft": 16,
16
+ "paddingRight": 16,
17
+ "paddingTop": 8,
18
+ }
19
+ }
20
+ >
21
+ <TextInput
22
+ keyboardType="email-address"
23
+ onChangeText={[Function]}
24
+ style={
25
+ {
26
+ "flex": 1,
27
+ "fontFamily": "SourceSansPro",
28
+ "fontSize": 16,
29
+ "lineHeight": 22.4,
30
+ }
31
+ }
32
+ />
33
+ </View>
34
+ `;
35
+
36
+ exports[`test input texts shows placeholder when provided 1`] = `
37
+ <View
38
+ style={
39
+ {
40
+ "backgroundColor": "#FFFFFF",
41
+ "borderColor": "#E5E8EB",
42
+ "borderRadius": 8,
43
+ "borderStyle": "solid",
44
+ "borderWidth": 1,
45
+ "flexDirection": "row",
46
+ "overflow": "hidden",
47
+ "paddingBottom": 8,
48
+ "paddingLeft": 16,
49
+ "paddingRight": 16,
50
+ "paddingTop": 8,
51
+ }
52
+ }
53
+ >
54
+ <TextInput
55
+ keyboardType="default"
56
+ onChangeText={[Function]}
57
+ placeholder="dummy placeholder"
58
+ style={
59
+ {
60
+ "flex": 1,
61
+ "fontFamily": "SourceSansPro",
62
+ "fontSize": 16,
63
+ "lineHeight": 22.4,
64
+ }
65
+ }
66
+ />
67
+ </View>
68
+ `;
@@ -0,0 +1,32 @@
1
+ import React, {useContext} from 'react';
2
+ import {View, TextInput as NativeTextInput} from 'react-native';
3
+ import {ThemeCtx} from '../../../context/theme.context';
4
+ import {Stylesheet} from './text-input.styles';
5
+ import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
6
+
7
+ type TextInputProps = {
8
+ placeholder?: string;
9
+ onchangeText?: (text: string) => void;
10
+ keyboardType: KeyBoardTypes;
11
+ };
12
+
13
+ const TextInput = ({
14
+ placeholder,
15
+ onchangeText,
16
+ keyboardType,
17
+ }: TextInputProps) => {
18
+ const context = useContext(ThemeCtx);
19
+ const styles = Stylesheet(context);
20
+
21
+ return (
22
+ <View style={styles.container}>
23
+ <NativeTextInput
24
+ placeholder={placeholder}
25
+ style={styles.input}
26
+ onChangeText={onchangeText}
27
+ keyboardType={keyboardType}
28
+ />
29
+ </View>
30
+ );
31
+ };
32
+ export {TextInput as TextInput};
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import {TextInput} from './text-input.component';
3
+ import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
4
+ import {SafeAreaView} from "react-native";
5
+
6
+ export const TextInputPreview = ({} = {}) => {
7
+ return (
8
+ <SafeAreaView>
9
+ <TextInput
10
+ onchangeText={(text: string) => console.log('text is changed to: ' + text)}
11
+ keyboardType={KeyBoardTypes.DECIMAL_PAD}
12
+ />
13
+ <TextInput
14
+ placeholder={'placeholder text'}
15
+ onchangeText={(text: string) => console.log('text is changed to: ' + text)}
16
+ keyboardType={KeyBoardTypes.DEFAULT}
17
+ />
18
+ <TextInput
19
+ onchangeText={(text: string) => console.log('text is changed to: ' + text)}
20
+ keyboardType={KeyBoardTypes.EMAIL_ADDRESS}
21
+ />
22
+ </SafeAreaView>
23
+ );
24
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import {StyleSheet} from 'react-native';
4
+ import {Scale} from '../../../theme/scale';
5
+ import {Font} from '../../../theme/font';
6
+
7
+ export const Stylesheet = (context) =>
8
+ StyleSheet.create({
9
+ container: {
10
+ flexDirection: 'row',
11
+ borderColor: context.colors.ui.lightgrey,
12
+ borderWidth: 1,
13
+ borderStyle: 'solid',
14
+ backgroundColor: context.colors.ui.white,
15
+ borderRadius: Scale.xs,
16
+ overflow: 'hidden',
17
+ paddingTop: Scale.xs,
18
+ paddingBottom: Scale.xs,
19
+ paddingLeft: Scale.m,
20
+ paddingRight: Scale.m,
21
+ },
22
+ input: {
23
+ flex: 1,
24
+ ...Font.medium,
25
+ }
26
+ });
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import {TextInput} from './text-input.component';
4
+ import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
5
+
6
+ describe('test input texts', () => {
7
+ it('shows placeholder when provided', () => {
8
+ const tree = renderer
9
+ .create(
10
+ <TextInput
11
+ keyboardType={KeyBoardTypes.DEFAULT}
12
+ placeholder="dummy placeholder"
13
+ onchangeText={() => console.log('text changed')}
14
+ />
15
+ )
16
+ .toJSON();
17
+
18
+ expect(tree).toMatchSnapshot();
19
+ });
20
+ it('shows icon when provided', () => {
21
+ const tree = renderer
22
+ .create(
23
+ <TextInput
24
+ keyboardType={KeyBoardTypes.EMAIL_ADDRESS}
25
+ onchangeText={() => console.log('text changed')}
26
+ />
27
+ )
28
+ .toJSON();
29
+
30
+ expect(tree).toMatchSnapshot();
31
+ });
32
+ });
@@ -0,0 +1,206 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test time-tracker given the visualState is DEFAULT return a blue colored ball 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "alignItems": "center",
8
+ "flexDirection": "row",
9
+ }
10
+ }
11
+ >
12
+ <View
13
+ style={
14
+ [
15
+ {
16
+ "borderRadius": 6,
17
+ "height": 12,
18
+ "marginRight": 4,
19
+ "width": 12,
20
+ },
21
+ {
22
+ "backgroundColor": "#19216C",
23
+ },
24
+ false,
25
+ false,
26
+ false,
27
+ ]
28
+ }
29
+ />
30
+ <Text
31
+ style={
32
+ {
33
+ "fontFamily": "Montserrat",
34
+ "fontSize": 11,
35
+ "lineHeight": 17.9,
36
+ }
37
+ }
38
+ >
39
+ 3u45
40
+ </Text>
41
+ </View>
42
+ `;
43
+
44
+ exports[`test time-tracker given the visualState is ERROR return a red colored ball 1`] = `
45
+ <View
46
+ style={
47
+ {
48
+ "alignItems": "center",
49
+ "flexDirection": "row",
50
+ }
51
+ }
52
+ >
53
+ <View
54
+ style={
55
+ [
56
+ {
57
+ "borderRadius": 6,
58
+ "height": 12,
59
+ "marginRight": 4,
60
+ "width": 12,
61
+ },
62
+ false,
63
+ false,
64
+ false,
65
+ {
66
+ "backgroundColor": "#F16868",
67
+ },
68
+ ]
69
+ }
70
+ />
71
+ <Text
72
+ style={
73
+ {
74
+ "fontFamily": "Montserrat",
75
+ "fontSize": 11,
76
+ "lineHeight": 17.9,
77
+ }
78
+ }
79
+ >
80
+ 3u45
81
+ </Text>
82
+ </View>
83
+ `;
84
+
85
+ exports[`test time-tracker given the visualState is SUCCESS return a green colored ball 1`] = `
86
+ <View
87
+ style={
88
+ {
89
+ "alignItems": "center",
90
+ "flexDirection": "row",
91
+ }
92
+ }
93
+ >
94
+ <View
95
+ style={
96
+ [
97
+ {
98
+ "borderRadius": 6,
99
+ "height": 12,
100
+ "marginRight": 4,
101
+ "width": 12,
102
+ },
103
+ false,
104
+ {
105
+ "backgroundColor": "#83D56C",
106
+ },
107
+ false,
108
+ false,
109
+ ]
110
+ }
111
+ />
112
+ <Text
113
+ style={
114
+ {
115
+ "fontFamily": "Montserrat",
116
+ "fontSize": 11,
117
+ "lineHeight": 17.9,
118
+ }
119
+ }
120
+ >
121
+ 3u45
122
+ </Text>
123
+ </View>
124
+ `;
125
+
126
+ exports[`test time-tracker given the visualState is WARNING return an orange colored ball 1`] = `
127
+ <View
128
+ style={
129
+ {
130
+ "alignItems": "center",
131
+ "flexDirection": "row",
132
+ }
133
+ }
134
+ >
135
+ <View
136
+ style={
137
+ [
138
+ {
139
+ "borderRadius": 6,
140
+ "height": 12,
141
+ "marginRight": 4,
142
+ "width": 12,
143
+ },
144
+ false,
145
+ false,
146
+ {
147
+ "backgroundColor": "#FCBF6F",
148
+ },
149
+ false,
150
+ ]
151
+ }
152
+ />
153
+ <Text
154
+ style={
155
+ {
156
+ "fontFamily": "Montserrat",
157
+ "fontSize": 11,
158
+ "lineHeight": 17.9,
159
+ }
160
+ }
161
+ >
162
+ 3u45
163
+ </Text>
164
+ </View>
165
+ `;
166
+
167
+ exports[`test time-tracker text has color when a color is given as property 1`] = `
168
+ <View
169
+ style={
170
+ {
171
+ "alignItems": "center",
172
+ "flexDirection": "row",
173
+ }
174
+ }
175
+ >
176
+ <View
177
+ style={
178
+ [
179
+ {
180
+ "borderRadius": 6,
181
+ "height": 12,
182
+ "marginRight": 4,
183
+ "width": 12,
184
+ },
185
+ {
186
+ "backgroundColor": "#19216C",
187
+ },
188
+ false,
189
+ false,
190
+ false,
191
+ ]
192
+ }
193
+ />
194
+ <Text
195
+ style={
196
+ {
197
+ "fontFamily": "Montserrat",
198
+ "fontSize": 11,
199
+ "lineHeight": 17.9,
200
+ }
201
+ }
202
+ >
203
+ 3u45
204
+ </Text>
205
+ </View>
206
+ `;
@@ -0,0 +1,24 @@
1
+ import React, {useContext} from 'react';
2
+ import {Stylesheet} from '../time-tracker/time-tracker.styles';
3
+ import {Text, View} from 'react-native';
4
+ import {VisualState} from '../../../types/visual-state.enum';
5
+ import {ThemeCtx} from '../../../context/theme.context';
6
+
7
+ type TimeTrackerProps = {
8
+ text: string;
9
+ visualState: VisualState;
10
+ };
11
+
12
+ const TimeTracker = ({text, visualState}: TimeTrackerProps) => {
13
+ const context = useContext(ThemeCtx);
14
+ const styles = Stylesheet(context, visualState);
15
+
16
+ return (
17
+ <View style={styles.container}>
18
+ <View style={styles.bal} />
19
+ <Text style={styles.text}>{text}</Text>
20
+ </View>
21
+ );
22
+ };
23
+
24
+ export {TimeTracker as TimeTracker};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import {VisualState} from '../../../types/visual-state.enum';
3
+ import {View} from 'react-native';
4
+ import {TimeTracker} from './time-tracker.component';
5
+
6
+ export const TimeTrackerPreview = ({}: {}) => {
7
+ return (
8
+ <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
9
+ <TimeTracker text={'niet gepland'} visualState={VisualState.DEFAULT} />
10
+ <TimeTracker text={'3u45m'} visualState={VisualState.SUCCESS} />
11
+ <TimeTracker text={'9u45m'} visualState={VisualState.WARNING} />
12
+ <TimeTracker text={'17u05m'} visualState={VisualState.ERROR} />
13
+ </View>
14
+ );
15
+ };
@@ -0,0 +1,36 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ import {VisualState} from '../../../types/visual-state.enum';
4
+ import {Font} from '../../../theme/font';
5
+ import {Scale} from '../../../theme/scale';
6
+
7
+ export const Stylesheet = (context, visualState) =>
8
+ StyleSheet.create({
9
+ container: {
10
+ flexDirection: 'row',
11
+ alignItems: 'center',
12
+ },
13
+ bal: [
14
+ {
15
+ width: Scale.s,
16
+ height: Scale.s,
17
+ borderRadius: Scale.s / 2,
18
+ marginRight: Scale.xxs,
19
+ },
20
+ visualState === VisualState.DEFAULT && {
21
+ backgroundColor: context.colors.main['0'],
22
+ },
23
+ visualState === VisualState.SUCCESS && {
24
+ backgroundColor: context.colors.ui.success.default,
25
+ },
26
+ visualState === VisualState.WARNING && {
27
+ backgroundColor: context.colors.ui.warning.default,
28
+ },
29
+ visualState === VisualState.ERROR && {
30
+ backgroundColor: context.colors.ui.error.default,
31
+ },
32
+ ],
33
+ text: {
34
+ ...Font.tiny,
35
+ },
36
+ });
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import {TimeTracker} from './time-tracker.component';
4
+ import render from 'react-test-renderer';
5
+
6
+ describe('test time-tracker', () => {
7
+ it('given the visualState is DEFAULT return a blue colored ball', () => {
8
+ const tree = renderer
9
+ .create(<TimeTracker text="3u45" visualState="DEFAULT" />)
10
+ .toJSON();
11
+ expect(tree).toMatchSnapshot();
12
+ });
13
+ it('given the visualState is SUCCESS return a green colored ball', () => {
14
+ const tree = renderer
15
+ .create(<TimeTracker text="3u45" visualState="SUCCESS" />)
16
+ .toJSON();
17
+ expect(tree).toMatchSnapshot();
18
+ });
19
+ it('given the visualState is WARNING return an orange colored ball', () => {
20
+ const tree = renderer
21
+ .create(<TimeTracker text="3u45" visualState="WARNING" />)
22
+ .toJSON();
23
+ expect(tree).toMatchSnapshot();
24
+ });
25
+ it('given the visualState is ERROR return a red colored ball', () => {
26
+ const tree = renderer
27
+ .create(<TimeTracker text="3u45" visualState="ERROR" />)
28
+ .toJSON();
29
+ expect(tree).toMatchSnapshot();
30
+ });
31
+ it('text has color when a color is given as property', () => {
32
+ const tree = renderer
33
+ .create(<TimeTracker text="3u45" visualState="DEFAULT" color="red" />)
34
+ .toJSON();
35
+ expect(tree).toMatchSnapshot();
36
+ });
37
+ });
@@ -0,0 +1,92 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test wide-button component should render a wide-button component 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
+ style={
18
+ {
19
+ "alignItems": "center",
20
+ "backgroundColor": "#19216C",
21
+ "borderRadius": 8,
22
+ "justifyContent": "center",
23
+ "paddingHorizontal": 24,
24
+ "paddingVertical": 12,
25
+ "width": "90%",
26
+ }
27
+ }
28
+ >
29
+ <Text
30
+ style={
31
+ {
32
+ "color": "#E0E8F9",
33
+ "fontFamily": "SourceSansPro",
34
+ "fontSize": 16,
35
+ "lineHeight": 22.4,
36
+ }
37
+ }
38
+ >
39
+
40
+ Bevestigen
41
+
42
+ </Text>
43
+ </View>
44
+ `;
45
+
46
+ exports[`test wide-button component should render a wide-button component that is disabled 1`] = `
47
+ <View
48
+ accessibilityState={
49
+ {
50
+ "disabled": true,
51
+ }
52
+ }
53
+ accessible={true}
54
+ collapsable={false}
55
+ focusable={true}
56
+ onBlur={[Function]}
57
+ onClick={[Function]}
58
+ onFocus={[Function]}
59
+ onResponderGrant={[Function]}
60
+ onResponderMove={[Function]}
61
+ onResponderRelease={[Function]}
62
+ onResponderTerminate={[Function]}
63
+ onResponderTerminationRequest={[Function]}
64
+ onStartShouldSetResponder={[Function]}
65
+ style={
66
+ {
67
+ "alignItems": "center",
68
+ "backgroundColor": "#E5E8EB",
69
+ "borderRadius": 8,
70
+ "justifyContent": "center",
71
+ "paddingHorizontal": 24,
72
+ "paddingVertical": 12,
73
+ "width": "90%",
74
+ }
75
+ }
76
+ >
77
+ <Text
78
+ style={
79
+ {
80
+ "color": "#515F6C",
81
+ "fontFamily": "SourceSansPro",
82
+ "fontSize": 16,
83
+ "lineHeight": 22.4,
84
+ }
85
+ }
86
+ >
87
+
88
+ Bevestigen
89
+
90
+ </Text>
91
+ </View>
92
+ `;