@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
package/.prettierrc.js
ADDED
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
package/App.tsx
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ScrollView, Button as ReactBtn} from 'react-native';
|
|
3
|
+
import {NavigationContainer} from '@react-navigation/native';
|
|
4
|
+
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
5
|
+
|
|
6
|
+
// Components
|
|
7
|
+
import {ThemeCtx} from './src/context/theme.context';
|
|
8
|
+
|
|
9
|
+
import {StaffMemberTheme} from './src/theme/provider';
|
|
10
|
+
import {LoadFonts} from './src/theme/font';
|
|
11
|
+
|
|
12
|
+
import {AvatarPreview} from './src/components/atoms/avatar/avatar.preview';
|
|
13
|
+
import {ButtonPreview} from './src/components/atoms/button/button.preview';
|
|
14
|
+
import {PillPreview} from './src/components/atoms/pill/pill.preview';
|
|
15
|
+
import {SnackbarPreview} from './src/components/atoms/snackbar/snackbar.preview';
|
|
16
|
+
import {TextBubblePreview} from './src/components/atoms/text-bubble/text-bubble.preview';
|
|
17
|
+
import {ImageBubblePreview} from './src/components/atoms/image-bubble/image-bubble.preview';
|
|
18
|
+
import {TimeTrackerPreview} from './src/components/atoms/time-tracker/time-tracker.preview';
|
|
19
|
+
import {CancelLinkPreview} from './src/components/atoms/cancel-link/cancel-link.preview';
|
|
20
|
+
import {InfoPreview} from './src/components/atoms/info/info.preview';
|
|
21
|
+
import {IconSolidPreview} from './src/icons/solid/solid.preview';
|
|
22
|
+
import {IconOutlineWhitePreview} from './src/icons/outline/outline-white.preview';
|
|
23
|
+
import {IconOutlineDefaultPreview} from './src/icons/outline/outline-default.preview';
|
|
24
|
+
import {IconOutlineGreyPreview} from './src/icons/outline/outline-grey.preview';
|
|
25
|
+
import {TagPreview} from './src/components/atoms/tag/tag.preview';
|
|
26
|
+
import {PopoverHeadingPreview} from './src/components/atoms/popover-heading/popover-heading.preview';
|
|
27
|
+
import {FilterTabPreview} from './src/components/atoms/filter-tab/filter-tab.preview';
|
|
28
|
+
import {ContactItemPreview} from './src/components/atoms/contact-item/contact-item.preview';
|
|
29
|
+
import {SelectListItemPreview} from './src/components/atoms/select-list-item/select-list-item-preview';
|
|
30
|
+
import {CheckboxPreview} from './src/components/atoms/checkbox/checkbox.preview';
|
|
31
|
+
import {CheckPreview} from './src/components/atoms/check-switch/check-switch.preview';
|
|
32
|
+
import {WideButtonPreview} from './src/components/atoms/wide-button/wide-button.preview';
|
|
33
|
+
import {PressableIconPreview} from './src/components/atoms/pressable-icon/pressable-icon.preview';
|
|
34
|
+
import {FormActionPreview} from './src/components/atoms/form-actions/form-action.preview';
|
|
35
|
+
import {QuickFilterPreview} from './src/components/atoms/quick-filter/quick-filter.prevriew';
|
|
36
|
+
import {TextInputPreview} from './src/components/atoms/text-input/text-input.preview';
|
|
37
|
+
import {ChildListItemPreview} from "./src/components/atoms/child-list-item/child-list-item.preview";
|
|
38
|
+
|
|
39
|
+
const Stack = createNativeStackNavigator();
|
|
40
|
+
|
|
41
|
+
const HomeScreen = ({navigation}: {navigation: any}) => {
|
|
42
|
+
return (
|
|
43
|
+
<ScrollView
|
|
44
|
+
style={{
|
|
45
|
+
flex: 1,
|
|
46
|
+
}}
|
|
47
|
+
contentContainerStyle={{
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
}}
|
|
51
|
+
><ReactBtn title="Avatar" onPress={() => navigation.push('avatar')} />
|
|
52
|
+
<ReactBtn title="Button" onPress={() => navigation.push('button')} />
|
|
53
|
+
<ReactBtn title="Pill" onPress={() => navigation.push('pill')} />
|
|
54
|
+
<ReactBtn title="Snackbar" onPress={() => navigation.push('snackbar')} />
|
|
55
|
+
<ReactBtn
|
|
56
|
+
title="textInputs"
|
|
57
|
+
onPress={() => navigation.push('textInputs')}
|
|
58
|
+
/>
|
|
59
|
+
<ReactBtn
|
|
60
|
+
title="textBubble"
|
|
61
|
+
onPress={() => navigation.push('textBubble')}
|
|
62
|
+
/>
|
|
63
|
+
<ReactBtn
|
|
64
|
+
title="ImageBubble"
|
|
65
|
+
onPress={() => navigation.push('image-bubble')}
|
|
66
|
+
/>
|
|
67
|
+
<ReactBtn
|
|
68
|
+
title="Pressable Icon"
|
|
69
|
+
onPress={() => navigation.push('pressable-icon')}
|
|
70
|
+
/>
|
|
71
|
+
<ReactBtn
|
|
72
|
+
title="Select-list-item"
|
|
73
|
+
onPress={() => navigation.push('select-list-item')}
|
|
74
|
+
/>
|
|
75
|
+
<ReactBtn
|
|
76
|
+
title="Cancel link"
|
|
77
|
+
onPress={() => navigation.push('cancel-link')}
|
|
78
|
+
/>
|
|
79
|
+
<ReactBtn
|
|
80
|
+
title="ContactItem"
|
|
81
|
+
onPress={() => navigation.push('contact-item')}
|
|
82
|
+
/>
|
|
83
|
+
<ReactBtn
|
|
84
|
+
title="Check switch"
|
|
85
|
+
onPress={() => navigation.push('check-switch')}
|
|
86
|
+
/>
|
|
87
|
+
<ReactBtn
|
|
88
|
+
title="Info component"
|
|
89
|
+
onPress={() => navigation.push('info')}
|
|
90
|
+
/>
|
|
91
|
+
<ReactBtn
|
|
92
|
+
title="child-list-item"
|
|
93
|
+
onPress={() => navigation.push('childList')}
|
|
94
|
+
/>
|
|
95
|
+
<ReactBtn
|
|
96
|
+
title="Wide Button"
|
|
97
|
+
onPress={() => navigation.push('wide-button')}
|
|
98
|
+
/>
|
|
99
|
+
<ReactBtn
|
|
100
|
+
title="Icons Default"
|
|
101
|
+
onPress={() => navigation.push('icons default')}
|
|
102
|
+
/>
|
|
103
|
+
<ReactBtn
|
|
104
|
+
title="Icons grey"
|
|
105
|
+
onPress={() => navigation.push('icons grey')}
|
|
106
|
+
/>
|
|
107
|
+
<ReactBtn
|
|
108
|
+
title="Icons White"
|
|
109
|
+
onPress={() => navigation.push('icons white')}
|
|
110
|
+
/>
|
|
111
|
+
<ReactBtn
|
|
112
|
+
title="Icons Solid"
|
|
113
|
+
onPress={() => navigation.push('icons solid')}
|
|
114
|
+
/>
|
|
115
|
+
<ReactBtn title="Checkbox" onPress={() => navigation.push('checkbox')} />
|
|
116
|
+
<ReactBtn
|
|
117
|
+
title="TimeTracker"
|
|
118
|
+
onPress={() => navigation.push('time-tracker')}
|
|
119
|
+
/>
|
|
120
|
+
<ReactBtn title="Tag" onPress={() => navigation.push('tag')} />
|
|
121
|
+
<ReactBtn
|
|
122
|
+
title="formAction"
|
|
123
|
+
onPress={() => navigation.push('form-action')}
|
|
124
|
+
/>
|
|
125
|
+
<ReactBtn
|
|
126
|
+
title="quickFilter"
|
|
127
|
+
onPress={() => navigation.push('quick-filter')}
|
|
128
|
+
/>
|
|
129
|
+
</ScrollView>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
function App() {
|
|
134
|
+
const [fontsLoaded] = LoadFonts();
|
|
135
|
+
|
|
136
|
+
if (!fontsLoaded) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<ThemeCtx.Provider value={StaffMemberTheme}>
|
|
142
|
+
<NavigationContainer>
|
|
143
|
+
<Stack.Navigator>
|
|
144
|
+
<Stack.Screen name="home">
|
|
145
|
+
{(props) => <HomeScreen {...props} />}
|
|
146
|
+
</Stack.Screen>
|
|
147
|
+
<Stack.Screen name="avatar">{() => <AvatarPreview />}</Stack.Screen>
|
|
148
|
+
<Stack.Screen name="button">{() => <ButtonPreview />}</Stack.Screen>
|
|
149
|
+
<Stack.Screen name="pill">{() => <PillPreview />}</Stack.Screen>
|
|
150
|
+
<Stack.Screen name="snackbar">
|
|
151
|
+
{() => <SnackbarPreview />}
|
|
152
|
+
</Stack.Screen>
|
|
153
|
+
<Stack.Screen name="textInputs">
|
|
154
|
+
{() => <TextInputPreview />}
|
|
155
|
+
</Stack.Screen>
|
|
156
|
+
<Stack.Screen name="textBubble">
|
|
157
|
+
{() => <TextBubblePreview />}
|
|
158
|
+
</Stack.Screen>
|
|
159
|
+
<Stack.Screen name="image-bubble">
|
|
160
|
+
{() => <ImageBubblePreview />}
|
|
161
|
+
</Stack.Screen>
|
|
162
|
+
<Stack.Screen name="pressable-icon">
|
|
163
|
+
{() => <PressableIconPreview />}
|
|
164
|
+
</Stack.Screen>
|
|
165
|
+
<Stack.Screen name="cancel-link">
|
|
166
|
+
{() => <CancelLinkPreview />}
|
|
167
|
+
</Stack.Screen>
|
|
168
|
+
<Stack.Screen name="contact-item">
|
|
169
|
+
{() => <ContactItemPreview />}
|
|
170
|
+
</Stack.Screen>
|
|
171
|
+
<Stack.Screen name="wide-button">
|
|
172
|
+
{() => <WideButtonPreview />}
|
|
173
|
+
</Stack.Screen>
|
|
174
|
+
<Stack.Screen name="info">{() => <InfoPreview />}</Stack.Screen>
|
|
175
|
+
<Stack.Screen name="check-switch">
|
|
176
|
+
{() => <CheckPreview />}
|
|
177
|
+
</Stack.Screen>
|
|
178
|
+
<Stack.Screen name="icons default">
|
|
179
|
+
{() => <IconOutlineDefaultPreview />}
|
|
180
|
+
</Stack.Screen>
|
|
181
|
+
<Stack.Screen name="icons grey">
|
|
182
|
+
{() => <IconOutlineGreyPreview />}
|
|
183
|
+
</Stack.Screen>
|
|
184
|
+
<Stack.Screen name="icons white">
|
|
185
|
+
{() => <IconOutlineWhitePreview />}
|
|
186
|
+
</Stack.Screen>
|
|
187
|
+
<Stack.Screen name="icons solid">
|
|
188
|
+
{() => <IconSolidPreview />}
|
|
189
|
+
</Stack.Screen>
|
|
190
|
+
<Stack.Screen name="select-list-item">
|
|
191
|
+
{() => <SelectListItemPreview />}
|
|
192
|
+
</Stack.Screen>
|
|
193
|
+
<Stack.Screen name="popover-heading">
|
|
194
|
+
{() => <PopoverHeadingPreview />}
|
|
195
|
+
</Stack.Screen>
|
|
196
|
+
<Stack.Screen name="filter tab">
|
|
197
|
+
{() => <FilterTabPreview />}
|
|
198
|
+
</Stack.Screen>
|
|
199
|
+
<Stack.Screen name="checkbox">
|
|
200
|
+
{() => <CheckboxPreview />}
|
|
201
|
+
</Stack.Screen>
|
|
202
|
+
<Stack.Screen name="time-tracker">
|
|
203
|
+
{() => <TimeTrackerPreview />}
|
|
204
|
+
</Stack.Screen>
|
|
205
|
+
<Stack.Screen name="tag">{() => <TagPreview />}</Stack.Screen>
|
|
206
|
+
<Stack.Screen name="form-action">
|
|
207
|
+
{() => <FormActionPreview />}
|
|
208
|
+
</Stack.Screen>
|
|
209
|
+
<Stack.Screen name="quick-filter">
|
|
210
|
+
{() => <QuickFilterPreview />}
|
|
211
|
+
</Stack.Screen>
|
|
212
|
+
<Stack.Screen name="childList">
|
|
213
|
+
{() => <ChildListItemPreview />}
|
|
214
|
+
</Stack.Screen>
|
|
215
|
+
</Stack.Navigator>
|
|
216
|
+
</NavigationContainer>
|
|
217
|
+
</ThemeCtx.Provider>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export default App;
|
package/app.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "Styleguide",
|
|
4
|
+
"slug": "Styleguide",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"orientation": "portrait",
|
|
7
|
+
"icon": "./assets/icon.png",
|
|
8
|
+
"userInterfaceStyle": "light",
|
|
9
|
+
"splash": {
|
|
10
|
+
"image": "./assets/splash.png",
|
|
11
|
+
"resizeMode": "contain",
|
|
12
|
+
"backgroundColor": "#ffffff"
|
|
13
|
+
},
|
|
14
|
+
"updates": {
|
|
15
|
+
"fallbackToCacheTimeout": 0
|
|
16
|
+
},
|
|
17
|
+
"assetBundlePatterns": [
|
|
18
|
+
"**/*"
|
|
19
|
+
],
|
|
20
|
+
"ios": {
|
|
21
|
+
"supportsTablet": true
|
|
22
|
+
},
|
|
23
|
+
"android": {
|
|
24
|
+
"adaptiveIcon": {
|
|
25
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
26
|
+
"backgroundColor": "#FFFFFF"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"web": {
|
|
30
|
+
"favicon": "./assets/favicon.png"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/icon.png
ADDED
|
Binary file
|
|
Binary file
|
package/babel.config.js
ADDED
package/jest.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module.exports = async () => {
|
|
2
|
+
return {
|
|
3
|
+
verbose: true,
|
|
4
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
5
|
+
preset: "jest-expo",
|
|
6
|
+
transformIgnorePatterns: [
|
|
7
|
+
"node_modules/(?!((jest-)?react-native" +
|
|
8
|
+
"|@react-native(-community)?)" +
|
|
9
|
+
"|expo(nent)?" +
|
|
10
|
+
"|@expo(nent)?/.*" +
|
|
11
|
+
"|@expo-google-fonts/.*" +
|
|
12
|
+
"|react-navigation" +
|
|
13
|
+
"|@react-navigation/.*" +
|
|
14
|
+
"|@unimodules/.*" +
|
|
15
|
+
"|unimodules" +
|
|
16
|
+
"|sentry-expo" +
|
|
17
|
+
"|native-base" +
|
|
18
|
+
"|react-native-svg" +
|
|
19
|
+
"|@tactics/kinderopvang-branding)"
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tactics/toddle-styleguide",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "node_modules/expo/AppEntry.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"expo": "node_modules/.bin/expo",
|
|
7
|
+
"start": "node_modules/.bin/tsc && node_modules/.bin/expo start",
|
|
8
|
+
"android": "node_modules/.bin/tsc && node_modules/.bin/expo start --android",
|
|
9
|
+
"ios": "node_modules/.bin/tsc && node_modules/.bin/expo start --ios",
|
|
10
|
+
"web": "node_modules/.bin/tsc && node_modules/.bin/expo start --web",
|
|
11
|
+
"test": "node_modules/.bin/jest",
|
|
12
|
+
"format": "yarn prettier --write src/."
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@callstack/react-theme-provider": "^3.0.8",
|
|
16
|
+
"@expo/webpack-config": "^0.17.0",
|
|
17
|
+
"@react-navigation/bottom-tabs": "^6.4.0",
|
|
18
|
+
"@react-navigation/drawer": "^6.5.0",
|
|
19
|
+
"@react-navigation/native": "^6.0.13",
|
|
20
|
+
"@react-navigation/native-stack": "^6.9.1",
|
|
21
|
+
"@react-navigation/stack": "^6.3.3",
|
|
22
|
+
"@tactics/kinderopvang-branding": "^1.0.1",
|
|
23
|
+
"expo": "~46.0.16",
|
|
24
|
+
"expo-font": "^10.2.1",
|
|
25
|
+
"expo-linear-gradient": "~11.4.0",
|
|
26
|
+
"expo-status-bar": "~1.4.0",
|
|
27
|
+
"formik": "^2.2.9",
|
|
28
|
+
"react": "18.0.0",
|
|
29
|
+
"react-dom": "18.0.0",
|
|
30
|
+
"react-native": "0.69.6",
|
|
31
|
+
"react-native-safe-area-context": "4.3.1",
|
|
32
|
+
"react-native-screens": "~3.15.0",
|
|
33
|
+
"react-native-svg": "12.3.0",
|
|
34
|
+
"react-native-web": "~0.18.7",
|
|
35
|
+
"react-test-renderer": "^18.2.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babel/core": "^7.12.9",
|
|
39
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
40
|
+
"@types/jest": "^29.2.1",
|
|
41
|
+
"@types/node": "^18.11.7",
|
|
42
|
+
"@types/react": "^18.0.24",
|
|
43
|
+
"@types/react-dom": "^18.0.8",
|
|
44
|
+
"@types/react-native": "^0.70.6",
|
|
45
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
46
|
+
"jest": "^29.2.2",
|
|
47
|
+
"jest-expo": "^46.0.1",
|
|
48
|
+
"prettier": "2.7.1",
|
|
49
|
+
"ts-jest": "^29.0.3",
|
|
50
|
+
"ts-node": "^10.9.1",
|
|
51
|
+
"typescript": "^4.8.4"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`test avatar given the isBlocked is true, and provide image source is empty return a red colored avatar 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
[
|
|
7
|
+
{
|
|
8
|
+
"alignItems": "center",
|
|
9
|
+
"backgroundColor": "#647ACB",
|
|
10
|
+
"justifyContent": "center",
|
|
11
|
+
"overflow": "hidden",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"borderRadius": 20,
|
|
15
|
+
"height": 40,
|
|
16
|
+
"width": 40,
|
|
17
|
+
},
|
|
18
|
+
false,
|
|
19
|
+
false,
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
>
|
|
23
|
+
<Text
|
|
24
|
+
style={
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
"color": "#FFFFFF",
|
|
28
|
+
"textTransform": "uppercase",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"fontFamily": "SourceSansProBold",
|
|
32
|
+
"fontSize": 16,
|
|
33
|
+
"lineHeight": 22.4,
|
|
34
|
+
},
|
|
35
|
+
false,
|
|
36
|
+
false,
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
JD
|
|
41
|
+
</Text>
|
|
42
|
+
</View>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`test avatar renders correctly when provided image source is empty 1`] = `
|
|
46
|
+
<View
|
|
47
|
+
style={
|
|
48
|
+
[
|
|
49
|
+
{
|
|
50
|
+
"alignItems": "center",
|
|
51
|
+
"backgroundColor": "#647ACB",
|
|
52
|
+
"justifyContent": "center",
|
|
53
|
+
"overflow": "hidden",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"borderRadius": 20,
|
|
57
|
+
"height": 40,
|
|
58
|
+
"width": 40,
|
|
59
|
+
},
|
|
60
|
+
false,
|
|
61
|
+
false,
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
>
|
|
65
|
+
<Text
|
|
66
|
+
style={
|
|
67
|
+
[
|
|
68
|
+
{
|
|
69
|
+
"color": "#FFFFFF",
|
|
70
|
+
"textTransform": "uppercase",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"fontFamily": "SourceSansProBold",
|
|
74
|
+
"fontSize": 16,
|
|
75
|
+
"lineHeight": 22.4,
|
|
76
|
+
},
|
|
77
|
+
false,
|
|
78
|
+
false,
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
JD
|
|
83
|
+
</Text>
|
|
84
|
+
</View>
|
|
85
|
+
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {Image, ImageSourcePropType, View, Text, ImageStyle} from 'react-native';
|
|
3
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
|
+
import {Stylesheet} from './avatar.styles';
|
|
5
|
+
import {Size} from '../../../types/size.enum';
|
|
6
|
+
import {Initials} from '../../../models/initials.model';
|
|
7
|
+
import {MainGradient} from '../../../gradients/main/main.gradient';
|
|
8
|
+
|
|
9
|
+
type AvatarProps = {
|
|
10
|
+
source: ImageSourcePropType | Initials;
|
|
11
|
+
size: Size;
|
|
12
|
+
isBlocked?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Avatar: React.FC<AvatarProps> = ({source, size, isBlocked}) => {
|
|
16
|
+
const Context = useContext(ThemeCtx);
|
|
17
|
+
const styles = Stylesheet(Context, size, isBlocked);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{source instanceof Initials ? (
|
|
22
|
+
<View style={styles.container}>
|
|
23
|
+
<Text style={styles.text}>{source.toString()}</Text>
|
|
24
|
+
</View>
|
|
25
|
+
) : (
|
|
26
|
+
<View style={styles.container}>
|
|
27
|
+
<MainGradient />
|
|
28
|
+
<Image source={source} style={styles.image as ImageStyle} />
|
|
29
|
+
</View>
|
|
30
|
+
)}
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {Avatar as Avatar};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const {Avatar} = require('./avatar.component');
|
|
4
|
+
const {Size} = require('../../../types/size.enum');
|
|
5
|
+
const {Initials} = require('../../../models/initials.model');
|
|
6
|
+
const {View} = require('react-native');
|
|
7
|
+
|
|
8
|
+
export const AvatarPreview = ({}: {}) => {
|
|
9
|
+
return (
|
|
10
|
+
<View
|
|
11
|
+
style={{
|
|
12
|
+
flex: 1,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<Avatar
|
|
18
|
+
size={Size.LARGE}
|
|
19
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
20
|
+
/>
|
|
21
|
+
<Avatar
|
|
22
|
+
size={Size.MEDIUM}
|
|
23
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
24
|
+
/>
|
|
25
|
+
<Avatar
|
|
26
|
+
size={Size.SMALL}
|
|
27
|
+
source={require('./../../../../assets/components/avatar/baby.png')}
|
|
28
|
+
/>
|
|
29
|
+
<Avatar size={Size.LARGE} source={Initials.for('John', 'Doe')} />
|
|
30
|
+
<Avatar
|
|
31
|
+
size={Size.MEDIUM}
|
|
32
|
+
source={Initials.for('John', 'Doe')}
|
|
33
|
+
isBlocked={true}
|
|
34
|
+
/>
|
|
35
|
+
<Avatar size={Size.SMALL} source={Initials.for('John', 'Doe')} />
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Size} from '../../../types/size.enum';
|
|
3
|
+
import {Font} from '../../../theme/font';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (Context, size, isBlocked) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
container: [
|
|
8
|
+
{
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
backgroundColor: isBlocked
|
|
11
|
+
? Context.colors.ui.error.default
|
|
12
|
+
: Context.colors.main['5'],
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
},
|
|
16
|
+
size === Size.SMALL && {
|
|
17
|
+
width: 40,
|
|
18
|
+
height: 40,
|
|
19
|
+
borderRadius: 40 / 2,
|
|
20
|
+
},
|
|
21
|
+
size === Size.MEDIUM && {
|
|
22
|
+
width: 72,
|
|
23
|
+
height: 72,
|
|
24
|
+
borderRadius: 72 / 2,
|
|
25
|
+
},
|
|
26
|
+
size === Size.LARGE && {
|
|
27
|
+
width: 120,
|
|
28
|
+
height: 120,
|
|
29
|
+
borderRadius: 120 / 2,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
image: [
|
|
33
|
+
{
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
width: '90%',
|
|
36
|
+
height: '90%',
|
|
37
|
+
borderRadius: 50,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
text: [
|
|
41
|
+
{
|
|
42
|
+
color: Context.colors.ui.white,
|
|
43
|
+
textTransform: 'uppercase',
|
|
44
|
+
},
|
|
45
|
+
size === Size.SMALL && {
|
|
46
|
+
...Font.mediumBold,
|
|
47
|
+
},
|
|
48
|
+
size === Size.MEDIUM && {
|
|
49
|
+
...Font.bigBold,
|
|
50
|
+
},
|
|
51
|
+
size === Size.LARGE && {
|
|
52
|
+
...Font.hugeBold,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import {Avatar} from './avatar.component';
|
|
4
|
+
import {Initials} from '../../../models/initials.model';
|
|
5
|
+
import {Size} from '../../../types/size.enum';
|
|
6
|
+
|
|
7
|
+
describe('test avatar', () => {
|
|
8
|
+
it('renders correctly when provided image source is empty', () => {
|
|
9
|
+
const tree = renderer
|
|
10
|
+
.create(<Avatar source={Initials.for('John', 'Doe')} size={Size.SMALL} />)
|
|
11
|
+
.toJSON();
|
|
12
|
+
|
|
13
|
+
expect(tree).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
it('given the isBlocked is true, and provide image source is empty return a red colored avatar ', () => {
|
|
16
|
+
const tree = renderer
|
|
17
|
+
.create(<Avatar source={Initials.for('John', 'Doe')} size={Size.SMALL} />)
|
|
18
|
+
.toJSON();
|
|
19
|
+
|
|
20
|
+
expect(tree).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
});
|