@tactics/toddle-styleguide 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.expo-shared/assets.json +4 -0
- package/.github/workflows/run-tests.yml +16 -0
- package/.prettierrc.js +9 -0
- package/.yarnrc.yml +1 -0
- package/App.tsx +221 -0
- package/app.json +33 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/components/avatar/baby.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/montserrat/bold.ttf +0 -0
- package/assets/fonts/montserrat/regular.ttf +0 -0
- package/assets/fonts/source-sans-pro/bold.ttf +0 -0
- package/assets/fonts/source-sans-pro/regular.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +6 -0
- package/jest.config.js +22 -0
- package/package.json +53 -0
- package/src/components/atoms/avatar/__snapshots__/avatar.test.js.snap +85 -0
- package/src/components/atoms/avatar/avatar.component.tsx +35 -0
- package/src/components/atoms/avatar/avatar.preview.tsx +38 -0
- package/src/components/atoms/avatar/avatar.styles.js +55 -0
- package/src/components/atoms/avatar/avatar.test.js +22 -0
- package/src/components/atoms/button/__snapshots__/button.test.js.snap +307 -0
- package/src/components/atoms/button/button.component.tsx +27 -0
- package/src/components/atoms/button/button.preview.tsx +34 -0
- package/src/components/atoms/button/button.styles.js +25 -0
- package/src/components/atoms/button/button.test.js +35 -0
- package/src/components/atoms/cancel-link/__snapshots__/cancel-link.test.js.snap +89 -0
- package/src/components/atoms/cancel-link/cancel-link.component.tsx +24 -0
- package/src/components/atoms/cancel-link/cancel-link.preview.tsx +20 -0
- package/src/components/atoms/cancel-link/cancel-link.styles.js +20 -0
- package/src/components/atoms/cancel-link/cancel-link.test.js +28 -0
- package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +67 -0
- package/src/components/atoms/check-switch/check-switch.component.tsx +46 -0
- package/src/components/atoms/check-switch/check-switch.preview.tsx +31 -0
- package/src/components/atoms/check-switch/check-switch.styles.js +36 -0
- package/src/components/atoms/check-switch/check-switch.test.js +13 -0
- package/src/components/atoms/checkbox/__snapshots__/checkbox.test.js.snap +120 -0
- package/src/components/atoms/checkbox/checkbox.component.tsx +26 -0
- package/src/components/atoms/checkbox/checkbox.preview.tsx +46 -0
- package/src/components/atoms/checkbox/checkbox.styles.js +35 -0
- package/src/components/atoms/checkbox/checkbox.test.js +30 -0
- package/src/components/atoms/child-list-item/__snapshots__/child-list-item.test.js.snap +635 -0
- package/src/components/atoms/child-list-item/child-list-item.component.tsx +81 -0
- package/src/components/atoms/child-list-item/child-list-item.preview.tsx +65 -0
- package/src/components/atoms/child-list-item/child-list-item.styles.js +82 -0
- package/src/components/atoms/child-list-item/child-list-item.test.js +73 -0
- package/src/components/atoms/contact-item/__snapshots__/contact-item.test.js.snap +321 -0
- package/src/components/atoms/contact-item/contact-item.component.tsx +61 -0
- package/src/components/atoms/contact-item/contact-item.preview.tsx +30 -0
- package/src/components/atoms/contact-item/contact-item.styles.js +26 -0
- package/src/components/atoms/contact-item/contact-item.test.js +20 -0
- package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +415 -0
- package/src/components/atoms/filter-tab/filter-tab.component.tsx +93 -0
- package/src/components/atoms/filter-tab/filter-tab.preview.tsx +37 -0
- package/src/components/atoms/filter-tab/filter-tab.styles.js +64 -0
- package/src/components/atoms/filter-tab/filter-tab.test.js +38 -0
- package/src/components/atoms/form-actions/__snapshots__/form-action.test.js.snap +176 -0
- package/src/components/atoms/form-actions/form-action.component.tsx +25 -0
- package/src/components/atoms/form-actions/form-action.preview.tsx +29 -0
- package/src/components/atoms/form-actions/form-action.styles.js +19 -0
- package/src/components/atoms/form-actions/form-action.test.js +32 -0
- package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +67 -0
- package/src/components/atoms/image-bubble/image-bubble.component.tsx +25 -0
- package/src/components/atoms/image-bubble/image-bubble.preview.tsx +19 -0
- package/src/components/atoms/image-bubble/image-bubble.styles.js +31 -0
- package/src/components/atoms/image-bubble/image-bubble.test.js +20 -0
- package/src/components/atoms/info/__snapshots__/info.test.js.snap +43 -0
- package/src/components/atoms/info/info.component.tsx +22 -0
- package/src/components/atoms/info/info.preview.tsx +20 -0
- package/src/components/atoms/info/info.styles.js +25 -0
- package/src/components/atoms/info/info.test.js +18 -0
- package/src/components/atoms/pill/__snapshots__/pill.test.js.snap +141 -0
- package/src/components/atoms/pill/pill.component.tsx +23 -0
- package/src/components/atoms/pill/pill.preview.tsx +21 -0
- package/src/components/atoms/pill/pill.styles.js +32 -0
- package/src/components/atoms/pill/pill.test.js +34 -0
- package/src/components/atoms/popover/components/backdrop/backdrop.component.tsx +40 -0
- package/src/components/atoms/popover/components/backdrop/backdrop.styles.js +15 -0
- package/src/components/atoms/popover/components/foreground/foreground.component.tsx +17 -0
- package/src/components/atoms/popover/components/foreground/foreground.styles.js +17 -0
- package/src/components/atoms/popover/components/index.js +5 -0
- package/src/components/atoms/popover/components/modal/close/close.component.tsx +21 -0
- package/src/components/atoms/popover/components/modal/close/close.styles.js +13 -0
- package/src/components/atoms/popover/components/modal/heading/heading.component.tsx +22 -0
- package/src/components/atoms/popover/components/modal/heading/heading.styles.js +24 -0
- package/src/components/atoms/popover/components/modal/modal.component.tsx +87 -0
- package/src/components/atoms/popover/components/modal/modal.styles.js +23 -0
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.tsx +18 -0
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.styles.js +10 -0
- package/src/components/atoms/popover/popover.component.tsx +60 -0
- package/src/components/atoms/popover/popover.preview.tsx +135 -0
- package/src/components/atoms/popover/popover.styles.js +12 -0
- package/src/components/atoms/popover-heading/__snapshots__/popover_heading.test.js.snap +35 -0
- package/src/components/atoms/popover-heading/popover-heading.component.tsx +22 -0
- package/src/components/atoms/popover-heading/popover-heading.preview.tsx +18 -0
- package/src/components/atoms/popover-heading/popover-heading.styles.js +19 -0
- package/src/components/atoms/popover-heading/popover_heading.test.js +11 -0
- package/src/components/atoms/pressable-icon/__snapshots__/pressable-icon.test.js.snap +364 -0
- package/src/components/atoms/pressable-icon/pressable-icon.component.tsx +48 -0
- package/src/components/atoms/pressable-icon/pressable-icon.preview.tsx +37 -0
- package/src/components/atoms/pressable-icon/pressable-icon.styles.js +25 -0
- package/src/components/atoms/pressable-icon/pressable-icon.test.js +47 -0
- package/src/components/atoms/quick-filter/__snapshots__/quick-filter.test.js.snap +465 -0
- package/src/components/atoms/quick-filter/quick-filter.component.tsx +32 -0
- package/src/components/atoms/quick-filter/quick-filter.prevriew.tsx +46 -0
- package/src/components/atoms/quick-filter/quick-filter.styles.js +68 -0
- package/src/components/atoms/quick-filter/quick-filter.test.js +127 -0
- package/src/components/atoms/select-list-item/__snapshots__/select-list-item.test.js.snap +391 -0
- package/src/components/atoms/select-list-item/select-list-item-preview.tsx +31 -0
- package/src/components/atoms/select-list-item/select-list-item.test.js +38 -0
- package/src/components/atoms/select-list-item/select-list.component-item.tsx +52 -0
- package/src/components/atoms/select-list-item/select-list.styles-item.js +40 -0
- package/src/components/atoms/snackbar/__snapshots__/snackbar.test.js.snap +493 -0
- package/src/components/atoms/snackbar/snackbar.component.tsx +28 -0
- package/src/components/atoms/snackbar/snackbar.preview.tsx +33 -0
- package/src/components/atoms/snackbar/snackbar.styles.js +82 -0
- package/src/components/atoms/snackbar/snackbar.test.js +35 -0
- package/src/components/atoms/tag/__snapshots__/tag.test.js.snap +87 -0
- package/src/components/atoms/tag/tag.component.tsx +37 -0
- package/src/components/atoms/tag/tag.preview.tsx +27 -0
- package/src/components/atoms/tag/tag.styles.js +22 -0
- package/src/components/atoms/tag/tag.test.js +24 -0
- package/src/components/atoms/text-bubble/__snapshots__/text-bubble.test.js.snap +337 -0
- package/src/components/atoms/text-bubble/text-bubble.component.tsx +32 -0
- package/src/components/atoms/text-bubble/text-bubble.preview.tsx +27 -0
- package/src/components/atoms/text-bubble/text-bubble.styles.js +64 -0
- package/src/components/atoms/text-bubble/text-bubble.test.js +84 -0
- package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +68 -0
- package/src/components/atoms/text-input/text-input.component.tsx +32 -0
- package/src/components/atoms/text-input/text-input.preview.tsx +24 -0
- package/src/components/atoms/text-input/text-input.styles.js +26 -0
- package/src/components/atoms/text-input/text-input.test.js +32 -0
- package/src/components/atoms/time-tracker/__snapshots__/time-tracker.test.js.snap +206 -0
- package/src/components/atoms/time-tracker/time-tracker.component.tsx +24 -0
- package/src/components/atoms/time-tracker/time-tracker.preview.tsx +15 -0
- package/src/components/atoms/time-tracker/time-tracker.styles.js +36 -0
- package/src/components/atoms/time-tracker/time-tracker.test.js +37 -0
- package/src/components/atoms/wide-button/__snapshots__/wide-button.test.js.snap +92 -0
- package/src/components/atoms/wide-button/wide-button.component.tsx +23 -0
- package/src/components/atoms/wide-button/wide-button.preview.tsx +18 -0
- package/src/components/atoms/wide-button/wide-button.styles.js +22 -0
- package/src/components/atoms/wide-button/wide-button.test.js +16 -0
- package/src/context/theme.context.ts +49 -0
- package/src/gradients/main/main.gradient.tsx +20 -0
- package/src/gradients/main/main.styles.js +11 -0
- package/src/icons/__snapshots__/icons.test.js.snap +2588 -0
- package/src/icons/icons.test.js +245 -0
- package/src/icons/index.tsx +7 -0
- package/src/icons/outline/calendar/calendar.icon.tsx +20 -0
- package/src/icons/outline/chat/chat.icon.tsx +20 -0
- package/src/icons/outline/chat-alt/chat-alt.icon.tsx +20 -0
- package/src/icons/outline/check-circle/check-circle.icon.tsx +20 -0
- package/src/icons/outline/chevron-left/chevron-left.icon.tsx +20 -0
- package/src/icons/outline/chevron-right/chevron-right.icon.tsx +20 -0
- package/src/icons/outline/clock/clock.icon.tsx +20 -0
- package/src/icons/outline/cloud-download/cloud-download.icon.tsx +20 -0
- package/src/icons/outline/cross/cross.icon.tsx +20 -0
- package/src/icons/outline/currency-euro/currency-euro.icon.tsx +20 -0
- package/src/icons/outline/document-text/document-text.icon.tsx +20 -0
- package/src/icons/outline/exclamation/exclamation.icon.tsx +20 -0
- package/src/icons/outline/exclamation-circle/exclamation-circle.icon.tsx +20 -0
- package/src/icons/outline/eye/eye.icon.tsx +27 -0
- package/src/icons/outline/filter/filter.icon.tsx +59 -0
- package/src/icons/outline/information-circle/information-circle.icon.tsx +20 -0
- package/src/icons/outline/logout/logout.icon.tsx +20 -0
- package/src/icons/outline/mail/mail.icon.tsx +20 -0
- package/src/icons/outline/mail-open/mail-open.icon.tsx +20 -0
- package/src/icons/outline/menu/menu.icon.tsx +20 -0
- package/src/icons/outline/minus-sm/minus-sm.icon.tsx +20 -0
- package/src/icons/outline/office-building/office-building.icon.tsx +20 -0
- package/src/icons/outline/outline-default.preview.tsx +99 -0
- package/src/icons/outline/outline-grey.preview.tsx +100 -0
- package/src/icons/outline/outline-white.preview.tsx +100 -0
- package/src/icons/outline/outline.tsx +81 -0
- package/src/icons/outline/paper-airplane/paper-airplane.icon.tsx +20 -0
- package/src/icons/outline/paperclip/paperclip.icon.tsx +20 -0
- package/src/icons/outline/pencil/pencil.icon.tsx +20 -0
- package/src/icons/outline/phone/phone.icon.tsx +20 -0
- package/src/icons/outline/plus/plus.icon.tsx +20 -0
- package/src/icons/outline/plus-sm/plus-sm.icon.tsx +20 -0
- package/src/icons/outline/qrcode/qrcode.icon.tsx +17 -0
- package/src/icons/outline/refresh/refresh.icon.tsx +20 -0
- package/src/icons/outline/search/search.icon.tsx +20 -0
- package/src/icons/outline/selector/selector.icon.tsx +20 -0
- package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.tsx +20 -0
- package/src/icons/outline/status-online/status-online.icon.tsx +20 -0
- package/src/icons/outline/thumb-up/thumb-up.icon.tsx +20 -0
- package/src/icons/outline/trash/trash.icon.tsx +20 -0
- package/src/icons/outline/user/user.icon.tsx +27 -0
- package/src/icons/outline/user-group/user-group.icon.tsx +20 -0
- package/src/icons/outline/users/users.icon.tsx +20 -0
- package/src/icons/solid/chat-alt/chat-alt-solid.icon.tsx +20 -0
- package/src/icons/solid/clock/clock-solid.icon.tsx +20 -0
- package/src/icons/solid/information-circle/information-circle-solid.icon.tsx +20 -0
- package/src/icons/solid/pencil/pencil-solid.icon.tsx +22 -0
- package/src/icons/solid/phone/phone-solid.icon.tsx +18 -0
- package/src/icons/solid/refresh/refresh-solid.icon.tsx +20 -0
- package/src/icons/solid/solid.preview.tsx +73 -0
- package/src/icons/solid/solid.tsx +19 -0
- package/src/icons/solid/status-online/status-online-solid.icon.tsx +24 -0
- package/src/icons/solid/trash/trash-solid.icon.tsx +20 -0
- package/src/models/hex-color.model.ts +25 -0
- package/src/models/hex-color.test.js +20 -0
- package/src/models/initials.model.ts +32 -0
- package/src/models/initials.test.js +23 -0
- package/src/theme/font/font.ts +72 -0
- package/src/theme/font/index.ts +4 -0
- package/src/theme/font/load-fonts.ts +10 -0
- package/src/theme/provider/index.ts +4 -0
- package/src/theme/provider/parent.theme.ts +45 -0
- package/src/theme/provider/staff-member.theme.ts +45 -0
- package/src/theme/scale/index.ts +14 -0
- package/src/types/bubble-alignment.enum.ts +4 -0
- package/src/types/icontype.type.ts +3 -0
- package/src/types/keyboard-types.enum.ts +9 -0
- package/src/types/size.enum.ts +5 -0
- package/src/types/visual-state.enum.ts +6 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
import {VisualState} from '../../../types/visual-state.enum';
|
|
4
|
+
import {QuickFilter} from './quick-filter.component';
|
|
5
|
+
|
|
6
|
+
describe('test quick filter', () => {
|
|
7
|
+
it('given the visual state is default AND isSelected is false ,return a white circle with a bleu border and a blue number', () => {
|
|
8
|
+
const tree = renderer
|
|
9
|
+
.create(
|
|
10
|
+
<QuickFilter
|
|
11
|
+
id="1"
|
|
12
|
+
amount={3}
|
|
13
|
+
isSelected={false}
|
|
14
|
+
onSelect={() => console.log('clicked')}
|
|
15
|
+
visualState={VisualState.DEFAULT}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
.toJSON();
|
|
19
|
+
|
|
20
|
+
expect(tree).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
it('given the visual state is default AND isSelected is true ,return a blue circle with a white number ', () => {
|
|
23
|
+
const tree = renderer
|
|
24
|
+
.create(
|
|
25
|
+
<QuickFilter
|
|
26
|
+
id="1"
|
|
27
|
+
amount={3}
|
|
28
|
+
isSelected={true}
|
|
29
|
+
onSelect={() => console.log('clicked')}
|
|
30
|
+
visualState={VisualState.DEFAULT}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
.toJSON();
|
|
34
|
+
|
|
35
|
+
expect(tree).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
it('given the visual state is success AND isSelected is false ,return a white circle with a green border and a green number', () => {
|
|
38
|
+
const tree = renderer
|
|
39
|
+
.create(
|
|
40
|
+
<QuickFilter
|
|
41
|
+
id="1"
|
|
42
|
+
amount={3}
|
|
43
|
+
isSelected={false}
|
|
44
|
+
onSelect={() => console.log('clicked')}
|
|
45
|
+
visualState={VisualState.DEFAULT}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
.toJSON();
|
|
49
|
+
|
|
50
|
+
expect(tree).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
it('given the visual state is success AND isSelected is true ,return a green circle with a white number ', () => {
|
|
53
|
+
const tree = renderer
|
|
54
|
+
.create(
|
|
55
|
+
<QuickFilter
|
|
56
|
+
id="1"
|
|
57
|
+
amount={3}
|
|
58
|
+
isSelected={true}
|
|
59
|
+
onSelect={() => console.log('clicked')}
|
|
60
|
+
visualState={VisualState.DEFAULT}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
.toJSON();
|
|
64
|
+
|
|
65
|
+
expect(tree).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
it('given the visual state is warning AND isSelected is false ,return a white circle with an orange border and an orange number', () => {
|
|
68
|
+
const tree = renderer
|
|
69
|
+
.create(
|
|
70
|
+
<QuickFilter
|
|
71
|
+
id="1"
|
|
72
|
+
amount={3}
|
|
73
|
+
isSelected={false}
|
|
74
|
+
onSelect={() => console.log('clicked')}
|
|
75
|
+
visualState={VisualState.DEFAULT}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
.toJSON();
|
|
79
|
+
|
|
80
|
+
expect(tree).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
it('given the visual state is warning AND isSelected is true ,return an orange circle with a white number', () => {
|
|
83
|
+
const tree = renderer
|
|
84
|
+
.create(
|
|
85
|
+
<QuickFilter
|
|
86
|
+
id="1"
|
|
87
|
+
amount={3}
|
|
88
|
+
isSelected={true}
|
|
89
|
+
onSelect={() => console.log('clicked')}
|
|
90
|
+
visualState={VisualState.DEFAULT}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
.toJSON();
|
|
94
|
+
|
|
95
|
+
expect(tree).toMatchSnapshot();
|
|
96
|
+
});
|
|
97
|
+
it('given the visual state is error AND isSelected is false ,return a white circle with a red border and a red number', () => {
|
|
98
|
+
const tree = renderer
|
|
99
|
+
.create(
|
|
100
|
+
<QuickFilter
|
|
101
|
+
id="1"
|
|
102
|
+
amount={3}
|
|
103
|
+
isSelected={false}
|
|
104
|
+
onSelect={() => console.log('clicked')}
|
|
105
|
+
visualState={VisualState.DEFAULT}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
.toJSON();
|
|
109
|
+
|
|
110
|
+
expect(tree).toMatchSnapshot();
|
|
111
|
+
});
|
|
112
|
+
it('given the visual state is error AND isSelected is true ,return a red circle with a white number ', () => {
|
|
113
|
+
const tree = renderer
|
|
114
|
+
.create(
|
|
115
|
+
<QuickFilter
|
|
116
|
+
id="1"
|
|
117
|
+
amount={3}
|
|
118
|
+
isSelected={true}
|
|
119
|
+
onSelect={() => console.log('clicked')}
|
|
120
|
+
visualState={VisualState.DEFAULT}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
.toJSON();
|
|
124
|
+
|
|
125
|
+
expect(tree).toMatchSnapshot();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`test button component should render a select-list-item component with 1 line of white text (bold) and a dark icon in a light circle 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
|
+
"flexDirection": "row",
|
|
23
|
+
"width": "100%",
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
>
|
|
27
|
+
<View
|
|
28
|
+
style={
|
|
29
|
+
{
|
|
30
|
+
"alignItems": "center",
|
|
31
|
+
"backgroundColor": "#7B93DB",
|
|
32
|
+
"borderRadius": 30,
|
|
33
|
+
"height": 60,
|
|
34
|
+
"justifyContent": "center",
|
|
35
|
+
"marginRight": 8,
|
|
36
|
+
"width": 60,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<View>
|
|
41
|
+
<RNSVGSvgView
|
|
42
|
+
align="xMidYMid"
|
|
43
|
+
bbHeight="28"
|
|
44
|
+
bbWidth="28"
|
|
45
|
+
fill="none"
|
|
46
|
+
focusable={false}
|
|
47
|
+
height="28"
|
|
48
|
+
meetOrSlice={0}
|
|
49
|
+
minX={0}
|
|
50
|
+
minY={0}
|
|
51
|
+
style={
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
"backgroundColor": "transparent",
|
|
55
|
+
"borderWidth": 0,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"flex": 0,
|
|
59
|
+
"height": 28,
|
|
60
|
+
"width": 28,
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
vbHeight={26}
|
|
65
|
+
vbWidth={26}
|
|
66
|
+
width="28"
|
|
67
|
+
>
|
|
68
|
+
<RNSVGGroup
|
|
69
|
+
fill={null}
|
|
70
|
+
propList={
|
|
71
|
+
[
|
|
72
|
+
"fill",
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
<RNSVGPath
|
|
77
|
+
d="M3.25 4.25C3.25 3.69772 3.69772 3.25 4.25 3.25H21.75C22.3023 3.25 22.75 3.69772 22.75 4.25V7.16912C22.75 7.43434 22.6446 7.68869 22.4571 7.87623L15.4596 14.8738C15.272 15.0613 15.1667 15.3157 15.1667 15.5809V18.4167L10.8333 22.75V15.5809C10.8333 15.3157 10.728 15.0613 10.5404 14.8738L3.54289 7.87623C3.35536 7.68869 3.25 7.43434 3.25 7.16912V4.25Z"
|
|
78
|
+
propList={
|
|
79
|
+
[
|
|
80
|
+
"stroke",
|
|
81
|
+
"strokeWidth",
|
|
82
|
+
"strokeLinecap",
|
|
83
|
+
"strokeLinejoin",
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
stroke={4279837036}
|
|
87
|
+
strokeLinecap={1}
|
|
88
|
+
strokeLinejoin={1}
|
|
89
|
+
strokeWidth="2"
|
|
90
|
+
/>
|
|
91
|
+
</RNSVGGroup>
|
|
92
|
+
</RNSVGSvgView>
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
<View
|
|
96
|
+
style={
|
|
97
|
+
{
|
|
98
|
+
"flex": 1,
|
|
99
|
+
"flexDirection": "column",
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
<View>
|
|
104
|
+
<Text
|
|
105
|
+
style={
|
|
106
|
+
{
|
|
107
|
+
"color": "#FFFFFF",
|
|
108
|
+
"fontFamily": "SourceSansProBold",
|
|
109
|
+
"fontSize": 24,
|
|
110
|
+
"lineHeight": 30.2,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
Vlindertjes
|
|
115
|
+
</Text>
|
|
116
|
+
</View>
|
|
117
|
+
<View>
|
|
118
|
+
<Text
|
|
119
|
+
style={
|
|
120
|
+
{
|
|
121
|
+
"color": "#E5E8EB",
|
|
122
|
+
"fontFamily": "Montserrat",
|
|
123
|
+
"fontSize": 14,
|
|
124
|
+
"lineHeight": 22.4,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/>
|
|
128
|
+
</View>
|
|
129
|
+
</View>
|
|
130
|
+
<View
|
|
131
|
+
style={
|
|
132
|
+
{
|
|
133
|
+
"height": 32,
|
|
134
|
+
"marginLeft": 8,
|
|
135
|
+
"width": 32,
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
<RNSVGSvgView
|
|
140
|
+
align="xMidYMid"
|
|
141
|
+
bbHeight="28"
|
|
142
|
+
bbWidth="28"
|
|
143
|
+
fill="none"
|
|
144
|
+
focusable={false}
|
|
145
|
+
height="28"
|
|
146
|
+
meetOrSlice={0}
|
|
147
|
+
minX={0}
|
|
148
|
+
minY={0}
|
|
149
|
+
style={
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
"backgroundColor": "transparent",
|
|
153
|
+
"borderWidth": 0,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"flex": 0,
|
|
157
|
+
"height": 28,
|
|
158
|
+
"width": 28,
|
|
159
|
+
},
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
vbHeight={27}
|
|
163
|
+
vbWidth={26}
|
|
164
|
+
width="28"
|
|
165
|
+
>
|
|
166
|
+
<RNSVGGroup
|
|
167
|
+
fill={null}
|
|
168
|
+
propList={
|
|
169
|
+
[
|
|
170
|
+
"fill",
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
>
|
|
174
|
+
<RNSVGPath
|
|
175
|
+
d="M9.75 5.625L17.3333 13.5L9.75 21.375"
|
|
176
|
+
propList={
|
|
177
|
+
[
|
|
178
|
+
"stroke",
|
|
179
|
+
"strokeWidth",
|
|
180
|
+
"strokeLinecap",
|
|
181
|
+
"strokeLinejoin",
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
stroke={4294967295}
|
|
185
|
+
strokeLinecap={1}
|
|
186
|
+
strokeLinejoin={1}
|
|
187
|
+
strokeWidth="2"
|
|
188
|
+
/>
|
|
189
|
+
</RNSVGGroup>
|
|
190
|
+
</RNSVGSvgView>
|
|
191
|
+
</View>
|
|
192
|
+
</View>
|
|
193
|
+
</View>
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
exports[`test button component should render a select-list-item component with 1 line of white text (bold) and a light icon in a dark circle 1`] = `"tree"`;
|
|
197
|
+
|
|
198
|
+
exports[`test button component should render a select-list-item component with 2 LINES of text and a dark icon in a light circle 1`] = `
|
|
199
|
+
<View
|
|
200
|
+
accessible={true}
|
|
201
|
+
collapsable={false}
|
|
202
|
+
focusable={true}
|
|
203
|
+
onBlur={[Function]}
|
|
204
|
+
onClick={[Function]}
|
|
205
|
+
onFocus={[Function]}
|
|
206
|
+
onResponderGrant={[Function]}
|
|
207
|
+
onResponderMove={[Function]}
|
|
208
|
+
onResponderRelease={[Function]}
|
|
209
|
+
onResponderTerminate={[Function]}
|
|
210
|
+
onResponderTerminationRequest={[Function]}
|
|
211
|
+
onStartShouldSetResponder={[Function]}
|
|
212
|
+
>
|
|
213
|
+
<View
|
|
214
|
+
style={
|
|
215
|
+
{
|
|
216
|
+
"alignItems": "center",
|
|
217
|
+
"flexDirection": "row",
|
|
218
|
+
"width": "100%",
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
>
|
|
222
|
+
<View
|
|
223
|
+
style={
|
|
224
|
+
{
|
|
225
|
+
"alignItems": "center",
|
|
226
|
+
"backgroundColor": "#7B93DB",
|
|
227
|
+
"borderRadius": 30,
|
|
228
|
+
"height": 60,
|
|
229
|
+
"justifyContent": "center",
|
|
230
|
+
"marginRight": 8,
|
|
231
|
+
"width": 60,
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
>
|
|
235
|
+
<View>
|
|
236
|
+
<RNSVGSvgView
|
|
237
|
+
align="xMidYMid"
|
|
238
|
+
bbHeight="28"
|
|
239
|
+
bbWidth="28"
|
|
240
|
+
fill="none"
|
|
241
|
+
focusable={false}
|
|
242
|
+
height="28"
|
|
243
|
+
meetOrSlice={0}
|
|
244
|
+
minX={0}
|
|
245
|
+
minY={0}
|
|
246
|
+
style={
|
|
247
|
+
[
|
|
248
|
+
{
|
|
249
|
+
"backgroundColor": "transparent",
|
|
250
|
+
"borderWidth": 0,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"flex": 0,
|
|
254
|
+
"height": 28,
|
|
255
|
+
"width": 28,
|
|
256
|
+
},
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
vbHeight={26}
|
|
260
|
+
vbWidth={26}
|
|
261
|
+
width="28"
|
|
262
|
+
>
|
|
263
|
+
<RNSVGGroup
|
|
264
|
+
fill={null}
|
|
265
|
+
propList={
|
|
266
|
+
[
|
|
267
|
+
"fill",
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
>
|
|
271
|
+
<RNSVGPath
|
|
272
|
+
d="M3.25 4.25C3.25 3.69772 3.69772 3.25 4.25 3.25H21.75C22.3023 3.25 22.75 3.69772 22.75 4.25V7.16912C22.75 7.43434 22.6446 7.68869 22.4571 7.87623L15.4596 14.8738C15.272 15.0613 15.1667 15.3157 15.1667 15.5809V18.4167L10.8333 22.75V15.5809C10.8333 15.3157 10.728 15.0613 10.5404 14.8738L3.54289 7.87623C3.35536 7.68869 3.25 7.43434 3.25 7.16912V4.25Z"
|
|
273
|
+
propList={
|
|
274
|
+
[
|
|
275
|
+
"stroke",
|
|
276
|
+
"strokeWidth",
|
|
277
|
+
"strokeLinecap",
|
|
278
|
+
"strokeLinejoin",
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
stroke={4279837036}
|
|
282
|
+
strokeLinecap={1}
|
|
283
|
+
strokeLinejoin={1}
|
|
284
|
+
strokeWidth="2"
|
|
285
|
+
/>
|
|
286
|
+
</RNSVGGroup>
|
|
287
|
+
</RNSVGSvgView>
|
|
288
|
+
</View>
|
|
289
|
+
</View>
|
|
290
|
+
<View
|
|
291
|
+
style={
|
|
292
|
+
{
|
|
293
|
+
"flex": 1,
|
|
294
|
+
"flexDirection": "column",
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
>
|
|
298
|
+
<View>
|
|
299
|
+
<Text
|
|
300
|
+
style={
|
|
301
|
+
{
|
|
302
|
+
"color": "#FFFFFF",
|
|
303
|
+
"fontFamily": "SourceSansProBold",
|
|
304
|
+
"fontSize": 24,
|
|
305
|
+
"lineHeight": 30.2,
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
>
|
|
309
|
+
Vlindertjes
|
|
310
|
+
</Text>
|
|
311
|
+
</View>
|
|
312
|
+
<View>
|
|
313
|
+
<Text
|
|
314
|
+
style={
|
|
315
|
+
{
|
|
316
|
+
"color": "#E5E8EB",
|
|
317
|
+
"fontFamily": "Montserrat",
|
|
318
|
+
"fontSize": 14,
|
|
319
|
+
"lineHeight": 22.4,
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
>
|
|
323
|
+
Leeftijd 2 tot 4 jaar
|
|
324
|
+
</Text>
|
|
325
|
+
</View>
|
|
326
|
+
</View>
|
|
327
|
+
<View
|
|
328
|
+
style={
|
|
329
|
+
{
|
|
330
|
+
"height": 32,
|
|
331
|
+
"marginLeft": 8,
|
|
332
|
+
"width": 32,
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
>
|
|
336
|
+
<RNSVGSvgView
|
|
337
|
+
align="xMidYMid"
|
|
338
|
+
bbHeight="28"
|
|
339
|
+
bbWidth="28"
|
|
340
|
+
fill="none"
|
|
341
|
+
focusable={false}
|
|
342
|
+
height="28"
|
|
343
|
+
meetOrSlice={0}
|
|
344
|
+
minX={0}
|
|
345
|
+
minY={0}
|
|
346
|
+
style={
|
|
347
|
+
[
|
|
348
|
+
{
|
|
349
|
+
"backgroundColor": "transparent",
|
|
350
|
+
"borderWidth": 0,
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"flex": 0,
|
|
354
|
+
"height": 28,
|
|
355
|
+
"width": 28,
|
|
356
|
+
},
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
vbHeight={27}
|
|
360
|
+
vbWidth={26}
|
|
361
|
+
width="28"
|
|
362
|
+
>
|
|
363
|
+
<RNSVGGroup
|
|
364
|
+
fill={null}
|
|
365
|
+
propList={
|
|
366
|
+
[
|
|
367
|
+
"fill",
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
<RNSVGPath
|
|
372
|
+
d="M9.75 5.625L17.3333 13.5L9.75 21.375"
|
|
373
|
+
propList={
|
|
374
|
+
[
|
|
375
|
+
"stroke",
|
|
376
|
+
"strokeWidth",
|
|
377
|
+
"strokeLinecap",
|
|
378
|
+
"strokeLinejoin",
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
stroke={4294967295}
|
|
382
|
+
strokeLinecap={1}
|
|
383
|
+
strokeLinejoin={1}
|
|
384
|
+
strokeWidth="2"
|
|
385
|
+
/>
|
|
386
|
+
</RNSVGGroup>
|
|
387
|
+
</RNSVGSvgView>
|
|
388
|
+
</View>
|
|
389
|
+
</View>
|
|
390
|
+
</View>
|
|
391
|
+
`;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {SelectListItem} from './select-list.component-item';
|
|
3
|
+
import {FilterIcon} from '../../../icons/outline/filter/filter.icon';
|
|
4
|
+
import {OfficeBuildingIcon} from '../../../icons/outline/office-building/office-building.icon';
|
|
5
|
+
|
|
6
|
+
const {View} = require('react-native');
|
|
7
|
+
|
|
8
|
+
export const SelectListItemPreview = ({}: {}) => {
|
|
9
|
+
return (
|
|
10
|
+
<View
|
|
11
|
+
style={{
|
|
12
|
+
flex: 1,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<SelectListItem
|
|
18
|
+
title="Vlindertjes"
|
|
19
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
20
|
+
icon={<FilterIcon />}
|
|
21
|
+
onPress={() => console.log('clicked')}
|
|
22
|
+
/>
|
|
23
|
+
<SelectListItem
|
|
24
|
+
title="Vlindertjes"
|
|
25
|
+
icon={<OfficeBuildingIcon />}
|
|
26
|
+
inverse={true}
|
|
27
|
+
onPress={() => console.log('clicked')}
|
|
28
|
+
/>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {SelectListItem} from './select-list.component-item';
|
|
4
|
+
import {FilterIcon} from '../../../icons/outline/filter/filter.icon';
|
|
5
|
+
import {OfficeBuildingIcon} from '../../../icons/outline/office-building/office-building.icon';
|
|
6
|
+
|
|
7
|
+
describe('test button component', () => {
|
|
8
|
+
it('should render a select-list-item component with 1 line of white text (bold) and a dark icon in a light circle', () => {
|
|
9
|
+
const tree = render
|
|
10
|
+
.create(<SelectListItem title={'Vlindertjes'} icon={<FilterIcon />} />)
|
|
11
|
+
.toJSON();
|
|
12
|
+
expect(tree).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
it('should render a select-list-item component with 1 line of white text (bold) and a light icon in a dark circle', () => {
|
|
15
|
+
const tree = render
|
|
16
|
+
.create(
|
|
17
|
+
<SelectListItem
|
|
18
|
+
title={'lindertjes'}
|
|
19
|
+
icon={<OfficeBuildingIcon />}
|
|
20
|
+
inverse={true}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
.toJSON();
|
|
24
|
+
expect('tree').toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
it('should render a select-list-item component with 2 LINES of text and a dark icon in a light circle', () => {
|
|
27
|
+
const tree = render
|
|
28
|
+
.create(
|
|
29
|
+
<SelectListItem
|
|
30
|
+
title={'Vlindertjes'}
|
|
31
|
+
subtitle={'Leeftijd 2 tot 4 jaar'}
|
|
32
|
+
icon={<FilterIcon />}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
.toJSON();
|
|
36
|
+
expect(tree).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
3
|
+
import {Pressable, Text, View} from 'react-native';
|
|
4
|
+
import {Stylesheet} from './select-list.styles-item';
|
|
5
|
+
import {ChevronRightIcon} from '../../../icons/outline/chevron-right/chevron-right.icon';
|
|
6
|
+
|
|
7
|
+
type SelectListProps = {
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
icon: React.ReactElement;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
inverse?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const SelectListItem = ({
|
|
16
|
+
title,
|
|
17
|
+
subtitle,
|
|
18
|
+
icon,
|
|
19
|
+
onPress,
|
|
20
|
+
inverse,
|
|
21
|
+
}: SelectListProps) => {
|
|
22
|
+
const context = useContext(ThemeCtx);
|
|
23
|
+
const styles = Stylesheet(context, inverse);
|
|
24
|
+
const invertedIcon = React.Children.map(icon, (child) =>
|
|
25
|
+
React.cloneElement(child, {
|
|
26
|
+
...icon.props,
|
|
27
|
+
color: context.colors.main[6],
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Pressable onPress={onPress}>
|
|
33
|
+
<View style={styles.container}>
|
|
34
|
+
<View style={styles.iconCircle}>
|
|
35
|
+
<View>{inverse ? invertedIcon : icon}</View>
|
|
36
|
+
</View>
|
|
37
|
+
<View style={styles.textContainer}>
|
|
38
|
+
<View>
|
|
39
|
+
<Text style={styles.title}>{title}</Text>
|
|
40
|
+
</View>
|
|
41
|
+
<View>
|
|
42
|
+
<Text style={styles.subtitle}>{subtitle}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
<View style={styles.iconSquare}>
|
|
46
|
+
<ChevronRightIcon color={context.colors.ui.white} />
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|
|
49
|
+
</Pressable>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
export {SelectListItem as SelectListItem};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Font} from '../../../theme/font';
|
|
3
|
+
import {Scale} from '../../../theme/scale';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (context, inverse) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
},
|
|
12
|
+
iconCircle: {
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
backgroundColor: inverse
|
|
16
|
+
? context.colors.main['3']
|
|
17
|
+
: context.colors.main['6'],
|
|
18
|
+
width: 60,
|
|
19
|
+
height: 60,
|
|
20
|
+
borderRadius: 60 / 2,
|
|
21
|
+
marginRight: Scale.xs,
|
|
22
|
+
},
|
|
23
|
+
textContainer: {
|
|
24
|
+
flex: 1,
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
...Font.bigBold,
|
|
29
|
+
color: context.colors.ui.white,
|
|
30
|
+
},
|
|
31
|
+
subtitle: {
|
|
32
|
+
...Font.regular,
|
|
33
|
+
color: context.colors.ui.lightgrey,
|
|
34
|
+
},
|
|
35
|
+
iconSquare: {
|
|
36
|
+
marginLeft: Scale.xs,
|
|
37
|
+
width: Scale.xl,
|
|
38
|
+
height: Scale.xl,
|
|
39
|
+
},
|
|
40
|
+
});
|