@tactics/toddle-styleguide 0.0.1 → 0.0.3
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/.github/workflows/publish_styleguide.yaml +30 -0
- package/App.tsx +21 -5
- package/index.tsx +62 -0
- package/package.json +10 -5
- package/src/components/atoms/avatar/avatar.component.tsx +3 -1
- package/src/components/atoms/button/button.component.tsx +3 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +5813 -0
- package/src/components/atoms/calendar/calendar.component.tsx +94 -0
- package/src/components/atoms/calendar/calendar.preview.tsx +44 -0
- package/src/components/atoms/calendar/calendar.styles.js +88 -0
- package/src/components/atoms/calendar/calendar.test.js +30 -0
- package/src/components/atoms/cancel-link/cancel-link.component.tsx +3 -1
- package/src/components/atoms/check-switch/check-switch.component.tsx +3 -1
- package/src/components/atoms/checkbox/checkbox.component.tsx +3 -1
- package/src/components/atoms/child-list-item/child-list-item.component.tsx +3 -1
- package/src/components/atoms/child-list-item/child-list-item.test.js +1 -1
- package/src/components/atoms/contact-item/contact-item.component.tsx +2 -1
- package/src/components/atoms/filter-tab/filter-tab.component.tsx +3 -1
- package/src/components/atoms/form-actions/form-action.component.tsx +3 -1
- package/src/components/atoms/image-bubble/image-bubble.component.tsx +3 -1
- package/src/components/atoms/increment-input/__snapshots__/increment-input.test.js.snap +210 -0
- package/src/components/atoms/increment-input/increment-input.component.tsx +41 -0
- package/src/components/atoms/increment-input/increment-input.preview.tsx +28 -0
- package/src/components/atoms/increment-input/increment-input.styles.js +49 -0
- package/src/components/atoms/increment-input/increment-input.test.js +14 -0
- package/src/components/atoms/info/info.component.tsx +3 -1
- package/src/components/atoms/pill/pill.component.tsx +3 -1
- package/src/components/atoms/popover/components/backdrop/backdrop.component.tsx +3 -1
- package/src/components/atoms/popover/components/foreground/foreground.component.tsx +3 -1
- package/src/components/atoms/popover/components/modal/close/close.component.tsx +3 -1
- package/src/components/atoms/popover/components/modal/heading/heading.component.tsx +3 -1
- package/src/components/atoms/popover/components/modal/modal.component.tsx +3 -1
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.tsx +4 -2
- package/src/components/atoms/popover/popover.component.tsx +3 -1
- package/src/components/atoms/pressable-icon/pressable-icon.component.tsx +3 -1
- package/src/components/atoms/quick-filter/quick-filter.component.tsx +3 -1
- package/src/components/atoms/select-list-item/select-list-item-preview.tsx +1 -1
- package/src/components/atoms/select-list-item/{select-list.component-item.tsx → select-list-item.component.tsx} +4 -2
- package/src/components/atoms/select-list-item/{select-list.styles-item.js → select-list-item.styles.js} +0 -0
- package/src/components/atoms/select-list-item/select-list-item.test.js +1 -1
- package/src/components/atoms/snackbar/snackbar.component.tsx +3 -1
- package/src/components/atoms/{popover-heading/popover-heading.styles.js → swipe/Swipe.styles.js} +2 -9
- package/src/components/atoms/swipe/__snapshots__/swipe.test.js.snap +589 -0
- package/src/components/atoms/swipe/swipe.component.tsx +39 -0
- package/src/components/atoms/swipe/swipe.preview.tsx +64 -0
- package/src/components/atoms/swipe/swipe.test.js +46 -0
- package/src/components/atoms/tag/tag.component.tsx +3 -1
- package/src/components/atoms/text-bubble/text-bubble.component.tsx +3 -1
- package/src/components/atoms/text-input/text-input.component.tsx +3 -1
- package/src/components/atoms/time-tracker/time-tracker.component.tsx +3 -1
- package/src/components/atoms/timeline/__snapshots__/timeline.test.js.snap +181 -0
- package/src/components/atoms/timeline/timeline.component.tsx +161 -0
- package/src/components/atoms/timeline/timeline.preview.tsx +43 -0
- package/src/components/atoms/timeline/timeline.styles.js +41 -0
- package/src/components/atoms/timeline/timeline.test.js +18 -0
- package/src/components/atoms/wide-button/wide-button.component.tsx +3 -1
- package/tsconfig.json +4 -1
- package/types/index.d.ts +23 -0
- package/types/src/components/atoms/avatar/avatar.component.d.ts +11 -0
- package/types/src/components/atoms/avatar/avatar.styles.d.ts +36 -0
- package/types/src/components/atoms/button/button.component.d.ts +9 -0
- package/types/src/components/atoms/button/button.styles.d.ts +20 -0
- package/types/src/components/atoms/cancel-link/cancel-link.component.d.ts +7 -0
- package/types/src/components/atoms/cancel-link/cancel-link.styles.d.ts +17 -0
- package/types/src/components/atoms/check-switch/check-switch.component.d.ts +7 -0
- package/types/src/components/atoms/check-switch/check-switch.styles.d.ts +30 -0
- package/types/src/components/atoms/checkbox/checkbox.component.d.ts +8 -0
- package/types/src/components/atoms/checkbox/checkbox.styles.d.ts +32 -0
- package/types/src/components/atoms/child-list-item/child-list-item.component.d.ts +19 -0
- package/types/src/components/atoms/child-list-item/child-list-item.styles.d.ts +68 -0
- package/types/src/components/atoms/contact-item/contact-item.component.d.ts +10 -0
- package/types/src/components/atoms/contact-item/contact-item.styles.d.ts +24 -0
- package/types/src/components/atoms/filter-tab/filter-tab.component.d.ts +9 -0
- package/types/src/components/atoms/filter-tab/filter-tab.styles.d.ts +61 -0
- package/types/src/components/atoms/form-actions/form-action.component.d.ts +7 -0
- package/types/src/components/atoms/form-actions/form-action.styles.d.ts +14 -0
- package/types/src/components/atoms/image-bubble/image-bubble.component.d.ts +9 -0
- package/types/src/components/atoms/image-bubble/image-bubble.styles.d.ts +27 -0
- package/types/src/components/atoms/info/info.component.d.ts +7 -0
- package/types/src/components/atoms/info/info.styles.d.ts +24 -0
- package/types/src/components/atoms/pill/pill.component.d.ts +8 -0
- package/types/src/components/atoms/pill/pill.styles.d.ts +24 -0
- package/types/src/components/atoms/popover/components/backdrop/backdrop.component.d.ts +6 -0
- package/types/src/components/atoms/popover/components/backdrop/backdrop.styles.d.ts +11 -0
- package/types/src/components/atoms/popover/components/foreground/foreground.component.d.ts +7 -0
- package/types/src/components/atoms/popover/components/foreground/foreground.styles.d.ts +12 -0
- package/types/src/components/atoms/popover/components/index.d.ts +4 -0
- package/types/src/components/atoms/popover/components/modal/close/close.component.d.ts +7 -0
- package/types/src/components/atoms/popover/components/modal/close/close.styles.d.ts +9 -0
- package/types/src/components/atoms/popover/components/modal/heading/heading.component.d.ts +7 -0
- package/types/src/components/atoms/popover/components/modal/heading/heading.styles.d.ts +22 -0
- package/types/src/components/atoms/popover/components/modal/modal.component.d.ts +11 -0
- package/types/src/components/atoms/popover/components/modal/modal.styles.d.ts +18 -0
- package/types/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.d.ts +6 -0
- package/types/src/components/atoms/popover/components/modal/scroll-content/scroll-content.styles.d.ts +6 -0
- package/types/src/components/atoms/popover/popover.component.d.ts +10 -0
- package/types/src/components/atoms/popover/popover.styles.d.ts +8 -0
- package/types/src/components/atoms/pressable-icon/pressable-icon.component.d.ts +9 -0
- package/types/src/components/atoms/pressable-icon/pressable-icon.styles.d.ts +17 -0
- package/types/src/components/atoms/quick-filter/quick-filter.component.d.ts +11 -0
- package/types/src/components/atoms/quick-filter/quick-filter.styles.d.ts +34 -0
- package/types/src/components/atoms/select-list-item/select-list-item.component.d.ts +10 -0
- package/types/src/components/atoms/select-list-item/select-list-item.styles.d.ts +37 -0
- package/types/src/components/atoms/snackbar/snackbar.component.d.ts +8 -0
- package/types/src/components/atoms/snackbar/snackbar.styles.d.ts +50 -0
- package/types/src/components/atoms/tag/tag.component.d.ts +13 -0
- package/types/src/components/atoms/tag/tag.styles.d.ts +16 -0
- package/types/src/components/atoms/text-bubble/text-bubble.component.d.ts +10 -0
- package/types/src/components/atoms/text-bubble/text-bubble.styles.d.ts +62 -0
- package/types/src/components/atoms/text-input/text-input.component.d.ts +9 -0
- package/types/src/components/atoms/text-input/text-input.styles.d.ts +21 -0
- package/types/src/components/atoms/time-tracker/time-tracker.component.d.ts +8 -0
- package/types/src/components/atoms/time-tracker/time-tracker.styles.d.ts +25 -0
- package/types/src/components/atoms/wide-button/wide-button.component.d.ts +8 -0
- package/types/src/components/atoms/wide-button/wide-button.styles.d.ts +17 -0
- package/types/src/context/theme.context.d.ts +46 -0
- package/types/src/gradients/main/main.gradient.d.ts +2 -0
- package/types/src/gradients/main/main.styles.d.ts +7 -0
- package/types/src/icons/outline/chevron-right/chevron-right.icon.d.ts +3 -0
- package/types/src/icons/outline/cross/cross.icon.d.ts +3 -0
- package/types/src/icons/outline/filter/filter.icon.d.ts +3 -0
- package/types/src/models/initials.model.d.ts +7 -0
- package/types/src/theme/font/font.d.ts +72 -0
- package/types/src/theme/font/index.d.ts +3 -0
- package/types/src/theme/font/load-fonts.d.ts +1 -0
- package/types/src/theme/provider/index.d.ts +3 -0
- package/types/src/theme/provider/parent.theme.d.ts +43 -0
- package/types/src/theme/provider/staff-member.theme.d.ts +43 -0
- package/types/src/theme/scale/index.d.ts +12 -0
- package/types/src/types/bubble-alignment.enum.d.ts +4 -0
- package/types/src/types/icontype.type.d.ts +3 -0
- package/types/src/types/keyboard-types.enum.d.ts +9 -0
- package/types/src/types/size.enum.d.ts +5 -0
- package/types/src/types/visual-state.enum.d.ts +6 -0
- package/src/components/atoms/popover-heading/__snapshots__/popover_heading.test.js.snap +0 -35
- package/src/components/atoms/popover-heading/popover-heading.component.tsx +0 -22
- package/src/components/atoms/popover-heading/popover-heading.preview.tsx +0 -18
- package/src/components/atoms/popover-heading/popover_heading.test.js +0 -11
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, {useContext, useMemo} from 'react';
|
|
2
|
+
import {Calendar as RNCalendar, LocaleConfig} from 'react-native-calendars/src';
|
|
3
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
|
+
import {Stylesheet} from './calendar.styles';
|
|
5
|
+
import {Icon} from '../../../icons';
|
|
6
|
+
|
|
7
|
+
LocaleConfig.locales['nl'] = {
|
|
8
|
+
monthNames: [
|
|
9
|
+
'Januari',
|
|
10
|
+
'Februari',
|
|
11
|
+
'Maart',
|
|
12
|
+
'April',
|
|
13
|
+
'Mei',
|
|
14
|
+
'Juni',
|
|
15
|
+
'Juli',
|
|
16
|
+
'Augustus',
|
|
17
|
+
'September',
|
|
18
|
+
'Oktober',
|
|
19
|
+
'November',
|
|
20
|
+
'December',
|
|
21
|
+
],
|
|
22
|
+
monthNamesShort: [
|
|
23
|
+
'Jan',
|
|
24
|
+
'Feb',
|
|
25
|
+
'Mrt',
|
|
26
|
+
'Apr',
|
|
27
|
+
'Mei',
|
|
28
|
+
'Jun',
|
|
29
|
+
'Jul',
|
|
30
|
+
'Aug',
|
|
31
|
+
'Sept',
|
|
32
|
+
'Okt',
|
|
33
|
+
'Nov',
|
|
34
|
+
'Dec',
|
|
35
|
+
],
|
|
36
|
+
dayNames: [
|
|
37
|
+
'Zondag',
|
|
38
|
+
'Maandag',
|
|
39
|
+
'Dinsdag',
|
|
40
|
+
'Woensdag',
|
|
41
|
+
'Donderdag',
|
|
42
|
+
'Vrijdag',
|
|
43
|
+
'Zaterdag',
|
|
44
|
+
],
|
|
45
|
+
dayNamesShort: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
LocaleConfig.defaultLocale = 'nl';
|
|
49
|
+
|
|
50
|
+
type CalendarProps = {
|
|
51
|
+
onDayPress: (day: string) => void;
|
|
52
|
+
selected: string;
|
|
53
|
+
minDate?: string;
|
|
54
|
+
maxDate?: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Calendar = ({
|
|
58
|
+
onDayPress,
|
|
59
|
+
selected,
|
|
60
|
+
minDate,
|
|
61
|
+
maxDate,
|
|
62
|
+
}: CalendarProps) => {
|
|
63
|
+
const context = useContext(ThemeCtx);
|
|
64
|
+
const styles = Stylesheet(context);
|
|
65
|
+
const initDate = new Date().toISOString().slice(0, 10);
|
|
66
|
+
const marked = useMemo(
|
|
67
|
+
() => ({
|
|
68
|
+
[selected]: {
|
|
69
|
+
selected: true,
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
[selected]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<RNCalendar
|
|
77
|
+
initialDate={initDate}
|
|
78
|
+
context={{date: ''}}
|
|
79
|
+
minDate={minDate}
|
|
80
|
+
maxDate={maxDate}
|
|
81
|
+
onDayPress={(day) => {
|
|
82
|
+
onDayPress(day.dateString);
|
|
83
|
+
}}
|
|
84
|
+
markedDates={marked}
|
|
85
|
+
theme={styles.custom}
|
|
86
|
+
firstDay={1}
|
|
87
|
+
enableSwipeMonths={true}
|
|
88
|
+
renderArrow={(direction) => {
|
|
89
|
+
if (direction === 'left') return <Icon.Outline.ChevronLeft />;
|
|
90
|
+
if (direction === 'right') return <Icon.Outline.ChevronRight />;
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Calendar} from './calendar.component';
|
|
3
|
+
import {useWindowDimensions} from 'react-native';
|
|
4
|
+
const {View} = require('react-native');
|
|
5
|
+
|
|
6
|
+
export const CalendarPreview = ({}: {}) => {
|
|
7
|
+
const full = useWindowDimensions();
|
|
8
|
+
const width = full.width;
|
|
9
|
+
|
|
10
|
+
const [selectedDay, setSelectedDay] = React.useState(
|
|
11
|
+
new Date().toISOString().slice(0, 10)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const calendarStartDate = '2022-09-01';
|
|
15
|
+
const calendarEndDate = '2023-07-31';
|
|
16
|
+
|
|
17
|
+
console.log(selectedDay);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View
|
|
21
|
+
style={{
|
|
22
|
+
flex: 1,
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<View
|
|
28
|
+
style={{
|
|
29
|
+
// borderColor: 'red',
|
|
30
|
+
// borderStyle: 'solid',
|
|
31
|
+
// borderWidth: 1,
|
|
32
|
+
width: width - 30,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Calendar
|
|
36
|
+
selected={selectedDay}
|
|
37
|
+
onDayPress={setSelectedDay}
|
|
38
|
+
minDate={calendarStartDate}
|
|
39
|
+
maxDate={calendarEndDate}
|
|
40
|
+
/>
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Scale} from '../../../theme/scale';
|
|
3
|
+
import {Font} from '../../../theme/font';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (context) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
custom: {
|
|
8
|
+
backgroundColor: context.colors.ui.white,
|
|
9
|
+
|
|
10
|
+
'stylesheet.calendar.header': {
|
|
11
|
+
headerContainer: {
|
|
12
|
+
height: 32,
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
backgroundColor: context.colors.main['0'],
|
|
17
|
+
borderRadius: Scale.xl,
|
|
18
|
+
paddingTop: Scale.xxs,
|
|
19
|
+
paddingRight: Scale.m,
|
|
20
|
+
paddingBottom: Scale.xxs,
|
|
21
|
+
paddingLeft: Scale.m,
|
|
22
|
+
},
|
|
23
|
+
monthText: {
|
|
24
|
+
fontSize: Font.medium.fontSize,
|
|
25
|
+
fontFamily: Font.medium.fontFamily,
|
|
26
|
+
lineHeight: Font.medium.lineHeight,
|
|
27
|
+
color: context.colors.ui.white,
|
|
28
|
+
margin: 0,
|
|
29
|
+
},
|
|
30
|
+
week: {
|
|
31
|
+
marginTop: Scale.xl,
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
justifyContent: 'space-around',
|
|
34
|
+
},
|
|
35
|
+
dayHeader: {
|
|
36
|
+
marginBottom: Scale.l,
|
|
37
|
+
width: 32,
|
|
38
|
+
textAlign: 'center',
|
|
39
|
+
fontSize: Font.mediumBold.fontSize,
|
|
40
|
+
fontFamily: Font.mediumBold.fontFamily,
|
|
41
|
+
lineHeight: Font.mediumBold.lineHeight,
|
|
42
|
+
color: context.colors.ui.black,
|
|
43
|
+
},
|
|
44
|
+
disabledDayHeader: {
|
|
45
|
+
color: context.colors.ui.grey,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
'stylesheet.day.basic': {
|
|
50
|
+
container: {
|
|
51
|
+
alignSelf: 'stretch',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
},
|
|
54
|
+
base: {
|
|
55
|
+
width: 42,
|
|
56
|
+
height: 42,
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
},
|
|
60
|
+
text: {
|
|
61
|
+
marginTop: 4,
|
|
62
|
+
fontSize: Font.medium.fontSize,
|
|
63
|
+
fontFamily: Font.medium.fontFamily,
|
|
64
|
+
lineHeight: Font.medium.lineHeight,
|
|
65
|
+
color: context.colors.ui.black,
|
|
66
|
+
},
|
|
67
|
+
selected: {
|
|
68
|
+
backgroundColor: context.colors.main['6'],
|
|
69
|
+
borderRadius: 21,
|
|
70
|
+
},
|
|
71
|
+
today: {
|
|
72
|
+
borderWidth: 1,
|
|
73
|
+
borderStyle: 'solid',
|
|
74
|
+
borderColor: context.colors.main['6'],
|
|
75
|
+
borderRadius: 21,
|
|
76
|
+
},
|
|
77
|
+
todayText: {
|
|
78
|
+
color: context.colors.main['6'],
|
|
79
|
+
},
|
|
80
|
+
selectedText: {
|
|
81
|
+
color: context.colors.ui.white,
|
|
82
|
+
},
|
|
83
|
+
disabledText: {
|
|
84
|
+
color: context.colors.ui.grey,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {Calendar} from './calendar.component';
|
|
4
|
+
|
|
5
|
+
describe('Test for the calendar component', () => {
|
|
6
|
+
it('renders a calendar where you can select a day', function () {
|
|
7
|
+
const tree = render
|
|
8
|
+
.create(
|
|
9
|
+
<Calendar
|
|
10
|
+
selected={'2022-12-02'}
|
|
11
|
+
onDayPress={() => console.log('pressed day')}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
.toJSON();
|
|
15
|
+
expect(tree).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
it('renders a calendar where you can select a day, and give a starting-, end-date for the calendar', function () {
|
|
18
|
+
const tree = render
|
|
19
|
+
.create(
|
|
20
|
+
<Calendar
|
|
21
|
+
selected={'2022-12-02'}
|
|
22
|
+
onDayPress={() => console.log('pressed day')}
|
|
23
|
+
minDate={'2022-01-01'}
|
|
24
|
+
maxDate={'2022-12-31'}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
.toJSON();
|
|
28
|
+
expect(tree).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
2
4
|
import {Pressable, Text, View} from 'react-native';
|
|
3
5
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
6
|
import {Stylesheet} from './cancel-link.styles';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext, useRef } from 'react';
|
|
3
|
+
|
|
2
4
|
import {View, Animated, Pressable, Easing} from 'react-native';
|
|
3
5
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
6
|
import {Stylesheet} from './check-switch.styles';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
2
4
|
import {Pressable, Text, View} from 'react-native';
|
|
3
5
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
6
|
import {Stylesheet} from './checkbox.styles';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
2
4
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
3
5
|
import {ImageSourcePropType, Pressable, View, Text} from 'react-native';
|
|
4
6
|
import {Initials} from '../../../models/initials.model';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import render from 'react-test-renderer';
|
|
3
3
|
import {ChildListItem} from './child-list-item.component';
|
|
4
4
|
import {Avatar} from '../avatar/avatar.component';
|
|
5
|
-
import {SelectListItem} from '../select-list-item/select-list.component
|
|
5
|
+
import {SelectListItem} from '../select-list-item/select-list-item.component';
|
|
6
6
|
import renderer from 'react-test-renderer';
|
|
7
7
|
import {VisualState} from '../../../types/visual-state.enum';
|
|
8
8
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import {Stylesheet} from './contact-item.styles';
|
|
3
4
|
import {Avatar} from '../avatar/avatar.component';
|
|
4
5
|
import {Initials} from '../../../models/initials.model';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
|
|
2
4
|
import {Animated, Pressable, Text, View} from 'react-native';
|
|
3
5
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
6
|
import {Stylesheet} from './filter-tab.styles';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
2
4
|
import {View, Image, ImageSourcePropType, ImageStyle} from 'react-native';
|
|
3
5
|
import {Stylesheet} from './image-bubble.styles';
|
|
4
6
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Increment input test renders an increment input component 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"alignItems": "center",
|
|
8
|
+
"display": "flex",
|
|
9
|
+
"flexDirection": "row",
|
|
10
|
+
"justifyContent": "center",
|
|
11
|
+
"width": "100%",
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
<View
|
|
16
|
+
accessible={true}
|
|
17
|
+
collapsable={false}
|
|
18
|
+
focusable={true}
|
|
19
|
+
onBlur={[Function]}
|
|
20
|
+
onClick={[Function]}
|
|
21
|
+
onFocus={[Function]}
|
|
22
|
+
onResponderGrant={[Function]}
|
|
23
|
+
onResponderMove={[Function]}
|
|
24
|
+
onResponderRelease={[Function]}
|
|
25
|
+
onResponderTerminate={[Function]}
|
|
26
|
+
onResponderTerminationRequest={[Function]}
|
|
27
|
+
onStartShouldSetResponder={[Function]}
|
|
28
|
+
style={
|
|
29
|
+
{
|
|
30
|
+
"alignItems": "center",
|
|
31
|
+
"backgroundColor": "#19216C",
|
|
32
|
+
"borderRadius": 50,
|
|
33
|
+
"height": 32,
|
|
34
|
+
"justifyContent": "center",
|
|
35
|
+
"width": 32,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<RNSVGSvgView
|
|
40
|
+
align="xMidYMid"
|
|
41
|
+
bbHeight="28"
|
|
42
|
+
bbWidth="28"
|
|
43
|
+
fill="none"
|
|
44
|
+
focusable={false}
|
|
45
|
+
height="28"
|
|
46
|
+
meetOrSlice={0}
|
|
47
|
+
minX={0}
|
|
48
|
+
minY={0}
|
|
49
|
+
style={
|
|
50
|
+
[
|
|
51
|
+
{
|
|
52
|
+
"backgroundColor": "transparent",
|
|
53
|
+
"borderWidth": 0,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"flex": 0,
|
|
57
|
+
"height": 28,
|
|
58
|
+
"width": 28,
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
vbHeight={26}
|
|
63
|
+
vbWidth={26}
|
|
64
|
+
width="28"
|
|
65
|
+
>
|
|
66
|
+
<RNSVGGroup
|
|
67
|
+
fill={null}
|
|
68
|
+
propList={
|
|
69
|
+
[
|
|
70
|
+
"fill",
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
<RNSVGPath
|
|
75
|
+
d="M19.4006 13H6.60059"
|
|
76
|
+
propList={
|
|
77
|
+
[
|
|
78
|
+
"stroke",
|
|
79
|
+
"strokeWidth",
|
|
80
|
+
"strokeLinecap",
|
|
81
|
+
"strokeLinejoin",
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
stroke={4294967295}
|
|
85
|
+
strokeLinecap={1}
|
|
86
|
+
strokeLinejoin={1}
|
|
87
|
+
strokeWidth="2"
|
|
88
|
+
/>
|
|
89
|
+
</RNSVGGroup>
|
|
90
|
+
</RNSVGSvgView>
|
|
91
|
+
</View>
|
|
92
|
+
<View
|
|
93
|
+
style={
|
|
94
|
+
{
|
|
95
|
+
"alignItems": "center",
|
|
96
|
+
"backgroundColor": "#FFFFFF",
|
|
97
|
+
"borderColor": "#E5E8EB",
|
|
98
|
+
"borderRadius": 8,
|
|
99
|
+
"borderStyle": "solid",
|
|
100
|
+
"borderWidth": 1,
|
|
101
|
+
"display": "flex",
|
|
102
|
+
"height": 48,
|
|
103
|
+
"justifyContent": "center",
|
|
104
|
+
"marginLeft": 8,
|
|
105
|
+
"marginRight": 8,
|
|
106
|
+
"paddingBottom": 8,
|
|
107
|
+
"paddingLeft": 16,
|
|
108
|
+
"paddingRight": 16,
|
|
109
|
+
"paddingTop": 8,
|
|
110
|
+
"width": 48,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
<Text
|
|
115
|
+
style={
|
|
116
|
+
{
|
|
117
|
+
"alignItems": "center",
|
|
118
|
+
"color": "#1F2933",
|
|
119
|
+
"display": "flex",
|
|
120
|
+
"fontFamily": "Montserrat",
|
|
121
|
+
"fontSize": 14,
|
|
122
|
+
"justifyContent": "center",
|
|
123
|
+
"lineHeight": 22.4,
|
|
124
|
+
"textAlign": "center",
|
|
125
|
+
"textAlignVertical": "center",
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
>
|
|
129
|
+
0
|
|
130
|
+
</Text>
|
|
131
|
+
</View>
|
|
132
|
+
<View
|
|
133
|
+
accessible={true}
|
|
134
|
+
collapsable={false}
|
|
135
|
+
focusable={true}
|
|
136
|
+
onBlur={[Function]}
|
|
137
|
+
onClick={[Function]}
|
|
138
|
+
onFocus={[Function]}
|
|
139
|
+
onResponderGrant={[Function]}
|
|
140
|
+
onResponderMove={[Function]}
|
|
141
|
+
onResponderRelease={[Function]}
|
|
142
|
+
onResponderTerminate={[Function]}
|
|
143
|
+
onResponderTerminationRequest={[Function]}
|
|
144
|
+
onStartShouldSetResponder={[Function]}
|
|
145
|
+
style={
|
|
146
|
+
{
|
|
147
|
+
"alignItems": "center",
|
|
148
|
+
"backgroundColor": "#19216C",
|
|
149
|
+
"borderRadius": 50,
|
|
150
|
+
"height": 32,
|
|
151
|
+
"justifyContent": "center",
|
|
152
|
+
"width": 32,
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<RNSVGSvgView
|
|
157
|
+
align="xMidYMid"
|
|
158
|
+
bbHeight="28"
|
|
159
|
+
bbWidth="28"
|
|
160
|
+
fill="none"
|
|
161
|
+
focusable={false}
|
|
162
|
+
height="28"
|
|
163
|
+
meetOrSlice={0}
|
|
164
|
+
minX={0}
|
|
165
|
+
minY={0}
|
|
166
|
+
style={
|
|
167
|
+
[
|
|
168
|
+
{
|
|
169
|
+
"backgroundColor": "transparent",
|
|
170
|
+
"borderWidth": 0,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"flex": 0,
|
|
174
|
+
"height": 28,
|
|
175
|
+
"width": 28,
|
|
176
|
+
},
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
vbHeight={27}
|
|
180
|
+
vbWidth={27}
|
|
181
|
+
width="28"
|
|
182
|
+
>
|
|
183
|
+
<RNSVGGroup
|
|
184
|
+
fill={null}
|
|
185
|
+
propList={
|
|
186
|
+
[
|
|
187
|
+
"fill",
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
>
|
|
191
|
+
<RNSVGPath
|
|
192
|
+
d="M13.5 6.75V13.5M13.5 13.5V20.25M13.5 13.5H20.25M13.5 13.5L6.75 13.5"
|
|
193
|
+
propList={
|
|
194
|
+
[
|
|
195
|
+
"stroke",
|
|
196
|
+
"strokeWidth",
|
|
197
|
+
"strokeLinecap",
|
|
198
|
+
"strokeLinejoin",
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
stroke={4294967295}
|
|
202
|
+
strokeLinecap={1}
|
|
203
|
+
strokeLinejoin={1}
|
|
204
|
+
strokeWidth="2"
|
|
205
|
+
/>
|
|
206
|
+
</RNSVGGroup>
|
|
207
|
+
</RNSVGSvgView>
|
|
208
|
+
</View>
|
|
209
|
+
</View>
|
|
210
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {Pressable, View, Text} from 'react-native';
|
|
3
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
4
|
+
import {Stylesheet} from './increment-input.styles';
|
|
5
|
+
import {Icon} from '../../../icons';
|
|
6
|
+
|
|
7
|
+
type IncrementInputProps = {
|
|
8
|
+
value: number;
|
|
9
|
+
onPress: (number: number) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const IncrementInput = ({value, onPress}: IncrementInputProps) => {
|
|
13
|
+
const context = useContext(ThemeCtx);
|
|
14
|
+
const styles = Stylesheet(context);
|
|
15
|
+
|
|
16
|
+
function increment() {
|
|
17
|
+
return onPress((value += 1));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function decrement() {
|
|
21
|
+
if (value > 0) {
|
|
22
|
+
return onPress((value -= 1));
|
|
23
|
+
} else {
|
|
24
|
+
return onPress((value = 0));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<Pressable onPress={decrement} style={styles.buttonContainer}>
|
|
31
|
+
<Icon.Outline.MinusSm color={context.colors.ui.white} />
|
|
32
|
+
</Pressable>
|
|
33
|
+
<View style={styles.numberContainer}>
|
|
34
|
+
<Text style={styles.number}>{value}</Text>
|
|
35
|
+
</View>
|
|
36
|
+
<Pressable onPress={increment} style={styles.buttonContainer}>
|
|
37
|
+
<Icon.Outline.PlusSm color={context.colors.ui.white} />
|
|
38
|
+
</Pressable>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import {IncrementInput} from './increment-input.component';
|
|
3
|
+
import {useWindowDimensions} from 'react-native';
|
|
4
|
+
const {View} = require('react-native');
|
|
5
|
+
|
|
6
|
+
export const IncrementInputPreview = ({}: {}) => {
|
|
7
|
+
const full = useWindowDimensions();
|
|
8
|
+
const width = full.width;
|
|
9
|
+
|
|
10
|
+
const [value, setValue] = useState(0);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
|
|
14
|
+
<View
|
|
15
|
+
style={{
|
|
16
|
+
borderColor: 'red',
|
|
17
|
+
borderStyle: 'solid',
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
width: width - 30,
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
<IncrementInput value={value} onPress={setValue} />
|
|
25
|
+
</View>
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Font} from '../../../theme/font';
|
|
3
|
+
import {Scale} from '../../../theme/scale';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (Context) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
},
|
|
14
|
+
buttonContainer: {
|
|
15
|
+
width: 32,
|
|
16
|
+
height: 32,
|
|
17
|
+
backgroundColor: Context.colors.main['0'],
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
borderRadius: 50,
|
|
21
|
+
},
|
|
22
|
+
numberContainer: {
|
|
23
|
+
width: Scale.xxl,
|
|
24
|
+
height: Scale.xxl,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
paddingTop: Scale.xs,
|
|
29
|
+
paddingRight: Scale.m,
|
|
30
|
+
paddingBottom: Scale.xs,
|
|
31
|
+
paddingLeft: Scale.m,
|
|
32
|
+
marginRight: Scale.xs,
|
|
33
|
+
marginLeft: Scale.xs,
|
|
34
|
+
backgroundColor: Context.colors.ui.white,
|
|
35
|
+
borderWidth: 1,
|
|
36
|
+
borderStyle: 'solid',
|
|
37
|
+
borderColor: Context.colors.ui.lightgrey,
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
},
|
|
40
|
+
number: {
|
|
41
|
+
...Font.regular,
|
|
42
|
+
textAlign: 'center',
|
|
43
|
+
textAlignVertical: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
color: Context.colors.ui.black,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {IncrementInput} from './increment-input.component';
|
|
4
|
+
|
|
5
|
+
describe('Increment input test', () => {
|
|
6
|
+
it('renders an increment input component', function () {
|
|
7
|
+
const tree = render
|
|
8
|
+
.create(
|
|
9
|
+
<IncrementInput value={0} onPress={() => console.log('change value')} />
|
|
10
|
+
)
|
|
11
|
+
.toJSON();
|
|
12
|
+
expect(tree).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
});
|