@tactics/toddle-styleguide 0.1.3 → 0.1.4
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/App.tsx +42 -9
- package/index.d.ts +16 -7
- package/index.tsx +59 -40
- package/jest.config.js +2 -0
- package/package.json +4 -4
- package/src/components/atoms/avatar/avatar.component.d.ts +7 -7
- package/src/components/atoms/blocked-message/__snapshots__/blocked-message.test.js.snap +87 -0
- package/src/components/atoms/blocked-message/blocked-message.component.d.ts +7 -0
- package/src/components/atoms/blocked-message/blocked-message.component.tsx +23 -0
- package/src/components/atoms/blocked-message/blocked-message.preview.d.ts +1 -0
- package/src/components/atoms/blocked-message/blocked-message.preview.tsx +23 -0
- package/src/components/atoms/blocked-message/blocked-message.styles.d.ts +22 -0
- package/src/components/atoms/blocked-message/blocked-message.styles.js +25 -0
- package/src/components/atoms/blocked-message/blocked-message.test.js +12 -0
- package/src/components/atoms/button/button.component.d.ts +11 -6
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +1691 -613
- package/src/components/atoms/calendar/calendar.component.d.ts +11 -6
- package/src/components/atoms/calendar/calendar.test.js +4 -2
- package/src/components/atoms/calendar-select/__snapshots__/calendar-select.test.js.snap +247 -0
- package/src/components/atoms/calendar-select/calendar-select.component.d.ts +10 -0
- package/src/components/atoms/calendar-select/calendar-select.component.tsx +56 -0
- package/src/components/atoms/calendar-select/calendar-select.preview.d.ts +1 -0
- package/src/components/atoms/calendar-select/calendar-select.preview.tsx +17 -0
- package/src/components/atoms/calendar-select/calendar-select.styles.d.ts +24 -0
- package/src/components/atoms/calendar-select/calendar-select.styles.js +30 -0
- package/src/components/atoms/calendar-select/calendar-select.test.js +20 -0
- package/src/components/atoms/cancel-link/cancel-link.component.d.ts +4 -4
- package/src/components/atoms/check-switch/check-switch.component.d.ts +3 -3
- package/src/components/atoms/checkbox/checkbox.component.d.ts +9 -5
- package/src/components/atoms/child-list-item/child-list-item.component.d.ts +28 -16
- package/src/components/atoms/contact-item/contact-item.component.d.ts +13 -7
- package/src/components/atoms/contact-role/__snapshots__/contact-role.test.js.snap +75 -0
- package/src/components/atoms/contact-role/contact-role.component.d.ts +9 -0
- package/src/components/atoms/contact-role/contact-role.component.tsx +22 -0
- package/src/components/atoms/contact-role/contact-role.preview.d.ts +1 -0
- package/src/components/atoms/contact-role/contact-role.preview.tsx +17 -0
- package/src/components/atoms/contact-role/contact-role.styles.d.ts +19 -0
- package/src/components/atoms/contact-role/contact-role.styles.js +20 -0
- package/src/components/atoms/contact-role/contact-role.test.js +18 -0
- package/src/components/atoms/date-input/__snapshots__/date-input.test.js.snap +1 -1
- package/src/components/atoms/date-input/date-input.component.d.ts +7 -4
- package/src/components/atoms/date-input/date-input.test.js +3 -1
- package/src/components/atoms/day-select/components/day/day.component.d.ts +6 -6
- package/src/components/atoms/day-select/components/day/day.component.tsx +1 -1
- package/src/components/atoms/day-select/components/day/day.styles.d.ts +43 -36
- package/src/components/atoms/day-select/components/day/day.styles.js +3 -0
- package/src/components/atoms/day-select/day-select.component.d.ts +10 -6
- package/src/components/atoms/day-select/day-select.component.tsx +17 -14
- package/src/components/atoms/day-select/day-select.styles.d.ts +8 -8
- package/src/components/atoms/department_logo/__snapshots__/department-logo.test.js.snap +16 -0
- package/src/components/atoms/department_logo/department-logo.component.d.ts +7 -0
- package/src/components/atoms/department_logo/department-logo.component.tsx +17 -0
- package/src/components/atoms/department_logo/department-logo.preview.d.ts +1 -0
- package/src/components/atoms/department_logo/department-logo.preview.tsx +11 -0
- package/src/components/atoms/department_logo/department-logo.styles.d.ts +8 -0
- package/src/components/atoms/department_logo/department-logo.styles.js +11 -0
- package/src/components/atoms/department_logo/department-logo.test.js +12 -0
- package/src/components/atoms/filter-range/filter-range.component.d.ts +14 -7
- package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +8 -2
- package/src/components/atoms/filter-tab/filter-tab.component.d.ts +9 -5
- package/src/components/atoms/filter-tab/filter-tab.component.tsx +3 -1
- package/src/components/atoms/filter-tab/filter-tab.preview.tsx +48 -5
- package/src/components/atoms/filter-tab/filter-tab.styles.js +6 -3
- package/src/components/atoms/filter-tab/filter-tab.test.js +6 -2
- package/src/components/atoms/form-actions/form-action.component.d.ts +4 -4
- package/src/components/atoms/image-bubble/image-bubble.component.d.ts +9 -6
- package/src/components/atoms/increment-input/__snapshots__/increment-input.test.js.snap +0 -1
- package/src/components/atoms/increment-input/increment-input.component.d.ts +6 -3
- package/src/components/atoms/increment-input/increment-input.styles.js +0 -1
- package/src/components/atoms/info/info.component.d.ts +4 -4
- package/src/components/atoms/logo/logo.component.d.ts +4 -4
- package/src/components/atoms/pill/pill.component.d.ts +5 -5
- package/src/components/atoms/popover/components/backdrop/backdrop.component.d.ts +3 -3
- package/src/components/atoms/popover/components/foreground/foreground.component.d.ts +4 -4
- package/src/components/atoms/popover/components/modal/close/close.component.d.ts +4 -4
- package/src/components/atoms/popover/components/modal/heading/heading.component.d.ts +4 -4
- package/src/components/atoms/popover/components/modal/modal.component.d.ts +15 -8
- package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.d.ts +5 -3
- package/src/components/atoms/popover/popover.component.d.ts +13 -7
- package/src/components/atoms/pressable-icon/pressable-icon.component.d.ts +10 -5
- package/src/components/atoms/quick-filter/quick-filter.component.d.ts +14 -8
- package/src/components/atoms/search/__snapshots__/search.test.js.snap +87 -0
- package/src/components/atoms/search/search.component.d.ts +12 -0
- package/src/components/atoms/search/search.component.tsx +32 -0
- package/src/components/atoms/search/search.preview.d.ts +1 -0
- package/src/components/atoms/search/search.preview.tsx +18 -0
- package/src/components/atoms/search/search.styles.d.ts +21 -0
- package/src/components/atoms/search/search.styles.js +26 -0
- package/src/components/atoms/search/search.test.js +20 -0
- package/src/components/atoms/select-list-item/__snapshots__/select-list-item.test.js.snap +2 -0
- package/src/components/atoms/select-list-item/select-list-item.component.d.ts +13 -7
- package/src/components/atoms/select-list-item/select-list-item.styles.js +1 -0
- package/src/components/atoms/select-picker/select-picker.component.d.ts +13 -8
- package/src/components/atoms/snackbar/snackbar.component.d.ts +5 -5
- package/src/components/atoms/swipe/swipe.component.d.ts +3 -3
- package/src/components/atoms/tag/tag.component.d.ts +13 -8
- package/src/components/atoms/text-bubble/text-bubble.component.d.ts +6 -6
- package/src/components/atoms/text-input/text-input.component.d.ts +10 -6
- package/src/components/atoms/text-input/text-input.preview.d.ts +1 -1
- package/src/components/atoms/time-tracker/time-tracker.component.d.ts +8 -5
- package/src/components/atoms/timeline/timeline.component.d.ts +6 -3
- package/src/components/atoms/wide-button/__snapshots__/wide-button.test.js.snap +93 -2
- package/src/components/atoms/wide-button/wide-button.component.d.ts +11 -5
- package/src/components/atoms/wide-button/wide-button.component.tsx +8 -2
- package/src/components/atoms/wide-button/wide-button.preview.tsx +10 -0
- package/src/components/atoms/wide-button/wide-button.styles.d.ts +3 -7
- package/src/components/atoms/wide-button/wide-button.styles.js +4 -2
- package/src/components/atoms/wide-button/wide-button.test.js +14 -0
- package/src/context/theme.context.d.ts +42 -42
- package/src/icons/index.d.ts +103 -51
- package/src/icons/outline/calendar/calendar.icon.d.ts +2 -2
- package/src/icons/outline/chat/chat.icon.d.ts +2 -2
- package/src/icons/outline/chat-alt/chat-alt.icon.d.ts +2 -2
- package/src/icons/outline/check-circle/check-circle.icon.d.ts +2 -2
- package/src/icons/outline/chevron-left/chevron-left.icon.d.ts +2 -2
- package/src/icons/outline/chevron-right/chevron-right.icon.d.ts +2 -2
- package/src/icons/outline/clock/clock.icon.d.ts +2 -2
- package/src/icons/outline/cloud-download/cloud-download.icon.d.ts +2 -2
- package/src/icons/outline/cross/cross.icon.d.ts +2 -2
- package/src/icons/outline/currency-euro/currency-euro.icon.d.ts +2 -2
- package/src/icons/outline/document-text/document-text.icon.d.ts +2 -2
- package/src/icons/outline/exclamation/exclamation.icon.d.ts +2 -2
- package/src/icons/outline/exclamation-circle/exclamation-circle.icon.d.ts +2 -2
- package/src/icons/outline/eye/eye.icon.d.ts +2 -2
- package/src/icons/outline/filter/filter.icon.d.ts +2 -2
- package/src/icons/outline/information-circle/information-circle.icon.d.ts +2 -2
- package/src/icons/outline/logout/logout.icon.d.ts +2 -2
- package/src/icons/outline/mail/mail.icon.d.ts +2 -2
- package/src/icons/outline/mail-open/mail-open.icon.d.ts +2 -2
- package/src/icons/outline/menu/menu.icon.d.ts +2 -2
- package/src/icons/outline/minus-sm/minus-sm.icon.d.ts +2 -2
- package/src/icons/outline/office-building/office-building.icon.d.ts +2 -2
- package/src/icons/outline/outline.d.ts +95 -39
- package/src/icons/outline/paper-airplane/paper-airplane.icon.d.ts +2 -2
- package/src/icons/outline/paperclip/paperclip.icon.d.ts +2 -2
- package/src/icons/outline/pencil/pencil.icon.d.ts +2 -2
- package/src/icons/outline/phone/phone.icon.d.ts +2 -2
- package/src/icons/outline/plus/plus.icon.d.ts +2 -2
- package/src/icons/outline/plus-sm/plus-sm.icon.d.ts +2 -2
- package/src/icons/outline/qrcode/qrcode.icon.d.ts +2 -2
- package/src/icons/outline/refresh/refresh.icon.d.ts +2 -2
- package/src/icons/outline/search/search.icon.d.ts +2 -2
- package/src/icons/outline/selector/selector.icon.d.ts +2 -2
- package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.d.ts +2 -2
- package/src/icons/outline/status-online/status-online.icon.d.ts +2 -2
- package/src/icons/outline/thumb-up/thumb-up.icon.d.ts +2 -2
- package/src/icons/outline/trash/trash.icon.d.ts +2 -2
- package/src/icons/outline/user/user.icon.d.ts +2 -2
- package/src/icons/outline/user-group/user-group.icon.d.ts +2 -2
- package/src/icons/outline/users/users.icon.d.ts +2 -2
- package/src/icons/solid/chat-alt/chat-alt-solid.icon.d.ts +2 -2
- package/src/icons/solid/clock/clock-solid.icon.d.ts +2 -2
- package/src/icons/solid/information-circle/information-circle-solid.icon.d.ts +2 -2
- package/src/icons/solid/pencil/pencil-solid.icon.d.ts +2 -2
- package/src/icons/solid/phone/phone-solid.icon.d.ts +2 -2
- package/src/icons/solid/refresh/refresh-solid.icon.d.ts +2 -2
- package/src/icons/solid/solid.d.ts +18 -8
- package/src/icons/solid/status-online/status-online-solid.icon.d.ts +2 -2
- package/src/icons/solid/trash/trash-solid.icon.d.ts +2 -2
- package/src/models/initials.model.d.ts +5 -5
- package/src/theme/font/font.d.ts +70 -70
- package/src/theme/font/index.d.ts +3 -3
- package/src/theme/provider/index.d.ts +3 -3
- package/src/theme/provider/parent.theme.d.ts +40 -40
- package/src/theme/provider/staff-member.theme.d.ts +40 -40
- package/src/theme/scale/index.d.ts +10 -10
- package/src/types/bubble-alignment.enum.d.ts +2 -2
- package/src/types/icontype.type.d.ts +1 -1
- package/src/types/keyboard-types.enum.d.ts +7 -7
- package/src/types/size.enum.d.ts +3 -3
- package/src/types/visual-state.enum.d.ts +4 -4
- package/src/util/date.d.ts +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ContactRole} from './contact-role.component';
|
|
3
|
+
const {View} = require('react-native');
|
|
4
|
+
|
|
5
|
+
export const ContactRolePreview = ({}: {}) => {
|
|
6
|
+
return (
|
|
7
|
+
<View
|
|
8
|
+
style={{
|
|
9
|
+
flex: 1,
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<ContactRole name={'Pieter Jannsens'} role={'Vader'} />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function Stylesheet(context: any): {
|
|
2
|
+
container: {
|
|
3
|
+
display: 'flex';
|
|
4
|
+
alignItems: 'center';
|
|
5
|
+
};
|
|
6
|
+
name: {
|
|
7
|
+
marginBottom: number;
|
|
8
|
+
color: any;
|
|
9
|
+
fontFamily: string;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
lineHeight: number;
|
|
12
|
+
};
|
|
13
|
+
role: {
|
|
14
|
+
color: any;
|
|
15
|
+
fontFamily: string;
|
|
16
|
+
fontSize: number;
|
|
17
|
+
lineHeight: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
...Font.bigBold,
|
|
13
|
+
marginBottom: Scale.xxs,
|
|
14
|
+
color: context.colors.ui.black,
|
|
15
|
+
},
|
|
16
|
+
role: {
|
|
17
|
+
...Font.small,
|
|
18
|
+
color: context.colors.ui.black,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {ContactRole} from './contact-role.component';
|
|
4
|
+
|
|
5
|
+
describe('Contact role component test', () => {
|
|
6
|
+
it('renders a contact who is the father', function () {
|
|
7
|
+
const tree = render
|
|
8
|
+
.create(<ContactRole name={'Darth Vader'} role={"I'm your Father"} />)
|
|
9
|
+
.toJSON();
|
|
10
|
+
expect(tree).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
it('renders a contact who is the sister', function () {
|
|
13
|
+
const tree = render
|
|
14
|
+
.create(<ContactRole name={'Princess Leia'} role={'Sister'} />)
|
|
15
|
+
.toJSON();
|
|
16
|
+
expect(tree).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {DateTime} from 'luxon';
|
|
2
2
|
declare type DateInputProps = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
onPress: () => void;
|
|
4
|
+
value: DateTime;
|
|
5
5
|
};
|
|
6
|
-
export declare const DateInput: ({
|
|
6
|
+
export declare const DateInput: ({
|
|
7
|
+
onPress,
|
|
8
|
+
value,
|
|
9
|
+
}: DateInputProps) => JSX.Element;
|
|
7
10
|
export {};
|
|
@@ -3,12 +3,14 @@ import renderer from 'react-test-renderer';
|
|
|
3
3
|
import {DateInput} from './date-input.component';
|
|
4
4
|
import {DateTime} from 'luxon';
|
|
5
5
|
|
|
6
|
+
const testDate = DateTime.fromISO('2022-12-01');
|
|
7
|
+
|
|
6
8
|
describe('Test date input component', () => {
|
|
7
9
|
it('renders a date input component', () => {
|
|
8
10
|
const tree = renderer
|
|
9
11
|
.create(
|
|
10
12
|
<DateInput
|
|
11
|
-
value={
|
|
13
|
+
value={testDate}
|
|
12
14
|
onPress={() => console.log('do something')}
|
|
13
15
|
/>
|
|
14
16
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {DateTime} from 'luxon';
|
|
2
2
|
declare type DayProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
date: DateTime;
|
|
4
|
+
onSelect: (date: DateTime) => void;
|
|
5
|
+
isSelected?: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare const Day: ({
|
|
8
|
-
export {
|
|
7
|
+
declare const Day: ({onSelect, date, isSelected}: DayProps) => JSX.Element;
|
|
8
|
+
export {Day as Day};
|
|
@@ -21,7 +21,7 @@ const Day = ({onSelect, date, isSelected}: DayProps) => {
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<View style={styles.container}>
|
|
24
|
-
<View>
|
|
24
|
+
<View style={styles.dayNameContainer}>
|
|
25
25
|
<Text style={[styles.dayName, styles.dayName]}>
|
|
26
26
|
{date.weekdayShort.toUpperCase().slice(0, 2)}
|
|
27
27
|
</Text>
|
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
export function Stylesheet(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
export function Stylesheet(
|
|
2
|
+
context: any,
|
|
3
|
+
isSelected: any,
|
|
4
|
+
isToday: any
|
|
5
|
+
): {
|
|
6
|
+
container: {
|
|
7
|
+
alignItems: 'center';
|
|
8
|
+
justifyContent: 'center';
|
|
9
|
+
backgroundColor: any;
|
|
10
|
+
};
|
|
11
|
+
dayCircle: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
borderRadius: number;
|
|
15
|
+
padding: number;
|
|
16
|
+
alignItems: 'center';
|
|
17
|
+
justifyContent: 'center';
|
|
18
|
+
backgroundColor: any;
|
|
19
|
+
borderColor: any;
|
|
20
|
+
borderWidth: number;
|
|
21
|
+
};
|
|
22
|
+
dayNumber: {
|
|
23
|
+
fontFamily: string;
|
|
24
|
+
fontSize: number;
|
|
25
|
+
lineHeight: number;
|
|
26
|
+
};
|
|
27
|
+
monthNumber: {
|
|
28
|
+
fontFamily: string;
|
|
29
|
+
fontSize: number;
|
|
30
|
+
lineHeight: number;
|
|
31
|
+
};
|
|
32
|
+
selectedDate: {
|
|
33
|
+
color: any;
|
|
34
|
+
};
|
|
35
|
+
dayNameContainer: {
|
|
36
|
+
marginBottom: number;
|
|
37
|
+
};
|
|
38
|
+
dayName: {
|
|
39
|
+
color: any;
|
|
40
|
+
fontFamily: string;
|
|
41
|
+
fontSize: number;
|
|
42
|
+
lineHeight: number;
|
|
43
|
+
};
|
|
37
44
|
};
|
|
@@ -34,6 +34,9 @@ export const Stylesheet = (context, isSelected, isToday) =>
|
|
|
34
34
|
selectedDate: {
|
|
35
35
|
color: isSelected ? context.colors.main[9] : context.colors.ui.grey,
|
|
36
36
|
},
|
|
37
|
+
dayNameContainer: {
|
|
38
|
+
marginBottom: Scale.s,
|
|
39
|
+
},
|
|
37
40
|
dayName: {
|
|
38
41
|
...Font.medium,
|
|
39
42
|
color: context.colors.ui.grey,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {DateTime} from 'luxon';
|
|
2
2
|
declare type DaySelectProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
onSelectDate: (date: DateTime) => void;
|
|
4
|
+
startDate: DateTime;
|
|
5
|
+
selectedDate: DateTime;
|
|
6
6
|
};
|
|
7
|
-
declare const DaySelect: ({
|
|
8
|
-
|
|
7
|
+
declare const DaySelect: ({
|
|
8
|
+
onSelectDate,
|
|
9
|
+
selectedDate,
|
|
10
|
+
startDate,
|
|
11
|
+
}: DaySelectProps) => JSX.Element;
|
|
12
|
+
export {DaySelect as DaySelect};
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Directions,
|
|
4
4
|
Gesture,
|
|
5
5
|
GestureDetector,
|
|
6
|
+
GestureHandlerRootView,
|
|
6
7
|
} from 'react-native-gesture-handler';
|
|
7
8
|
import {View} from 'react-native';
|
|
8
9
|
import {DateTime} from 'luxon';
|
|
@@ -71,20 +72,22 @@ const DaySelect = ({onSelectDate, selectedDate, startDate}: DaySelectProps) => {
|
|
|
71
72
|
);
|
|
72
73
|
|
|
73
74
|
return (
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
<GestureHandlerRootView>
|
|
76
|
+
<GestureDetector gesture={composedGesture}>
|
|
77
|
+
<View style={styles.container}>
|
|
78
|
+
{weekData.map((weekday) => {
|
|
79
|
+
return (
|
|
80
|
+
<Day
|
|
81
|
+
key={weekday.toString()}
|
|
82
|
+
date={weekday}
|
|
83
|
+
onSelect={onClick}
|
|
84
|
+
isSelected={isThisDaySelected(weekday)}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
88
|
+
</View>
|
|
89
|
+
</GestureDetector>
|
|
90
|
+
</GestureHandlerRootView>
|
|
88
91
|
);
|
|
89
92
|
};
|
|
90
93
|
export {DaySelect as DaySelect};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export function Stylesheet(context: any): {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
container: {
|
|
3
|
+
backgroundColor: any;
|
|
4
|
+
padding: number;
|
|
5
|
+
flexDirection: 'row';
|
|
6
|
+
justifyContent: 'space-evenly';
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
overflow: 'hidden';
|
|
9
|
+
};
|
|
10
10
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`test department-logo component should render a department-logo component 1`] = `
|
|
4
|
+
<Text
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"color": "#19216C",
|
|
8
|
+
"fontFamily": "Montserrat",
|
|
9
|
+
"fontSize": 13,
|
|
10
|
+
"lineHeight": 20.4,
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
>
|
|
14
|
+
Test Department
|
|
15
|
+
</Text>
|
|
16
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {useContext} from 'react';
|
|
3
|
+
import {View, Text} from 'react-native';
|
|
4
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
+
import {Stylesheet} from './department-logo.styles';
|
|
6
|
+
|
|
7
|
+
type DepartmentLogoProps = {
|
|
8
|
+
department: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const DepartmentLogo = ({department}: DepartmentLogoProps) => {
|
|
12
|
+
const context = useContext(ThemeCtx);
|
|
13
|
+
const styles = Stylesheet(context);
|
|
14
|
+
|
|
15
|
+
return <Text style={styles.container}>{department}</Text>;
|
|
16
|
+
};
|
|
17
|
+
export {DepartmentLogo as DepartmentLogo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DepartmentLogoPreview: ({}: {}) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {DepartmentLogo} from './department-logo.component';
|
|
3
|
+
import {View} from 'react-native';
|
|
4
|
+
|
|
5
|
+
export const DepartmentLogoPreview = ({}: {}) => {
|
|
6
|
+
return (
|
|
7
|
+
<View>
|
|
8
|
+
<DepartmentLogo department={'De Teddybeertjes'} />
|
|
9
|
+
</View>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import render from 'react-test-renderer';
|
|
3
|
+
import {DepartmentLogo} from './department-logo.component';
|
|
4
|
+
|
|
5
|
+
describe('test department-logo component', () => {
|
|
6
|
+
it('should render a department-logo component', function () {
|
|
7
|
+
const tree = render
|
|
8
|
+
.create(<DepartmentLogo department={'Test Department'} />)
|
|
9
|
+
.toJSON();
|
|
10
|
+
expect(tree).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
declare type FilterRangeProps = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
value: number | number[];
|
|
3
|
+
onChange: (value: number | number[]) => void;
|
|
4
|
+
minValue: number;
|
|
5
|
+
maxValue: number;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
suffix?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const FilterRange: ({
|
|
9
|
+
export declare const FilterRange: ({
|
|
10
|
+
value,
|
|
11
|
+
minValue,
|
|
12
|
+
maxValue,
|
|
13
|
+
onChange,
|
|
14
|
+
prefix,
|
|
15
|
+
suffix,
|
|
16
|
+
}: FilterRangeProps) => JSX.Element;
|
|
10
17
|
export {};
|
|
@@ -27,6 +27,7 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
|
|
|
27
27
|
<View
|
|
28
28
|
style={
|
|
29
29
|
{
|
|
30
|
+
"alignItems": "stretch",
|
|
30
31
|
"display": "flex",
|
|
31
32
|
"flexDirection": "column",
|
|
32
33
|
"position": "relative",
|
|
@@ -138,7 +139,9 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
|
|
|
138
139
|
{
|
|
139
140
|
"alignItems": "center",
|
|
140
141
|
"backgroundColor": "#647ACB",
|
|
141
|
-
"borderRadius":
|
|
142
|
+
"borderRadius": 12,
|
|
143
|
+
"marginTop": 3,
|
|
144
|
+
"maxHeight": 32,
|
|
142
145
|
"paddingBottom": 8,
|
|
143
146
|
"paddingLeft": 16,
|
|
144
147
|
"paddingRight": 16,
|
|
@@ -210,6 +213,7 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
|
|
|
210
213
|
<View
|
|
211
214
|
style={
|
|
212
215
|
{
|
|
216
|
+
"alignItems": "stretch",
|
|
213
217
|
"display": "flex",
|
|
214
218
|
"flexDirection": "column",
|
|
215
219
|
"position": "relative",
|
|
@@ -369,7 +373,9 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
|
|
|
369
373
|
{
|
|
370
374
|
"alignItems": "center",
|
|
371
375
|
"backgroundColor": "#647ACB",
|
|
372
|
-
"borderRadius":
|
|
376
|
+
"borderRadius": 12,
|
|
377
|
+
"marginTop": 3,
|
|
378
|
+
"maxHeight": 32,
|
|
373
379
|
"paddingBottom": 8,
|
|
374
380
|
"paddingLeft": 16,
|
|
375
381
|
"paddingRight": 16,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
declare type FilterTab = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
tabItem: {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}[];
|
|
6
|
+
filterValue: (value: string) => void;
|
|
6
7
|
};
|
|
7
|
-
export declare const FilterTab: ({
|
|
8
|
+
export declare const FilterTab: ({
|
|
9
|
+
tabItem,
|
|
10
|
+
filterValue,
|
|
11
|
+
}: FilterTab) => JSX.Element;
|
|
8
12
|
export {};
|
|
@@ -10,9 +10,10 @@ type FilterTab = {
|
|
|
10
10
|
value: string;
|
|
11
11
|
label: string;
|
|
12
12
|
}[];
|
|
13
|
+
filterValue: (value: string) => void;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export const FilterTab = ({tabItem}: FilterTab) => {
|
|
16
|
+
export const FilterTab = ({tabItem, filterValue}: FilterTab) => {
|
|
16
17
|
const [dimensions, setDimensions] = useState({width: 0, height: 0});
|
|
17
18
|
const [translateValue] = useState(new Animated.Value(0));
|
|
18
19
|
|
|
@@ -55,6 +56,7 @@ export const FilterTab = ({tabItem}: FilterTab) => {
|
|
|
55
56
|
setClickedButton(index);
|
|
56
57
|
setIsActive(!isActive);
|
|
57
58
|
translateTab(index, inRow);
|
|
59
|
+
filterValue(tab.value);
|
|
58
60
|
}}
|
|
59
61
|
>
|
|
60
62
|
<Text
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
2
|
import {FilterTab} from './filter-tab.component';
|
|
3
3
|
import {useWindowDimensions} from 'react-native';
|
|
4
4
|
const {View} = require('react-native');
|
|
@@ -19,19 +19,62 @@ export const FilterTabPreview = ({}: {}) => {
|
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
+
const data = [
|
|
23
|
+
{
|
|
24
|
+
value: 'M',
|
|
25
|
+
label: 'Jongen',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'V',
|
|
29
|
+
label: 'Meisje',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 'MV',
|
|
33
|
+
label: 'Beide',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 'MV',
|
|
37
|
+
label: 'Beide',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: 'MV',
|
|
41
|
+
label: 'Beide',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: 'MV',
|
|
45
|
+
label: 'Beide',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
22
49
|
const full = useWindowDimensions();
|
|
23
50
|
const width = full.width;
|
|
24
51
|
|
|
52
|
+
const [value, setValue] = useState('M');
|
|
53
|
+
|
|
54
|
+
function setFilterValue(value: string) {
|
|
55
|
+
setValue(value);
|
|
56
|
+
}
|
|
57
|
+
|
|
25
58
|
return (
|
|
26
59
|
<View
|
|
27
60
|
style={{
|
|
28
|
-
borderColor: 'red',
|
|
29
|
-
borderStyle: 'solid',
|
|
30
|
-
borderWidth: 1,
|
|
61
|
+
// borderColor: 'red',
|
|
62
|
+
// borderStyle: 'solid',
|
|
63
|
+
// borderWidth: 1,
|
|
31
64
|
width: width - 30,
|
|
32
65
|
}}
|
|
33
66
|
>
|
|
34
|
-
<
|
|
67
|
+
<View
|
|
68
|
+
style={{
|
|
69
|
+
marginTop: 20,
|
|
70
|
+
marginBottom: 20,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<FilterTab tabItem={tabs} filterValue={setFilterValue} />
|
|
74
|
+
</View>
|
|
75
|
+
<View>
|
|
76
|
+
<FilterTab tabItem={data} filterValue={setFilterValue} />
|
|
77
|
+
</View>
|
|
35
78
|
</View>
|
|
36
79
|
);
|
|
37
80
|
};
|
|
@@ -11,7 +11,7 @@ export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
|
|
|
11
11
|
paddingLeft: Scale.xxs,
|
|
12
12
|
paddingTop: Scale.xxs,
|
|
13
13
|
paddingBottom: Scale.xxs,
|
|
14
|
-
borderRadius:
|
|
14
|
+
borderRadius: inRow ? 50 : Scale.m,
|
|
15
15
|
backgroundColor: Context.colors.ui.lightgrey,
|
|
16
16
|
},
|
|
17
17
|
inner: {
|
|
@@ -21,6 +21,7 @@ export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
|
|
|
21
21
|
tabs: {
|
|
22
22
|
display: 'flex',
|
|
23
23
|
flexDirection: inRow ? 'row' : 'column',
|
|
24
|
+
alignItems: inRow ? 'center' : 'stretch',
|
|
24
25
|
width: '100%',
|
|
25
26
|
position: 'relative',
|
|
26
27
|
},
|
|
@@ -30,17 +31,19 @@ export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
|
|
|
30
31
|
paddingLeft: Scale.m,
|
|
31
32
|
paddingTop: Scale.xs,
|
|
32
33
|
paddingBottom: Scale.xs,
|
|
33
|
-
borderRadius:
|
|
34
|
+
borderRadius: Scale.m,
|
|
34
35
|
alignItems: 'center',
|
|
35
36
|
backgroundColor: 'transparent',
|
|
36
37
|
},
|
|
37
38
|
slidingTab: {
|
|
38
39
|
width: ItemWidth,
|
|
40
|
+
maxHeight: 32,
|
|
41
|
+
marginTop: inRow ? 0 : 3,
|
|
39
42
|
paddingRight: Scale.m,
|
|
40
43
|
paddingLeft: Scale.m,
|
|
41
44
|
paddingTop: Scale.xs,
|
|
42
45
|
paddingBottom: Scale.xs,
|
|
43
|
-
borderRadius:
|
|
46
|
+
borderRadius: inRow ? 50 : Scale.s,
|
|
44
47
|
zIndex: -1,
|
|
45
48
|
position: 'absolute',
|
|
46
49
|
backgroundColor: Context.colors.main['5'],
|
|
@@ -14,7 +14,9 @@ describe('Filter tab test', () => {
|
|
|
14
14
|
label: 'NFC',
|
|
15
15
|
},
|
|
16
16
|
];
|
|
17
|
-
const tree = render
|
|
17
|
+
const tree = render
|
|
18
|
+
.create(<FilterTab tabItem={tabs1} filterValue={() => 'NFC'} />)
|
|
19
|
+
.toJSON();
|
|
18
20
|
expect(tree).toMatchSnapshot();
|
|
19
21
|
});
|
|
20
22
|
it('renders a filter tab with 3 tabs', function () {
|
|
@@ -32,7 +34,9 @@ describe('Filter tab test', () => {
|
|
|
32
34
|
label: 'Beide',
|
|
33
35
|
},
|
|
34
36
|
];
|
|
35
|
-
const tree = render
|
|
37
|
+
const tree = render
|
|
38
|
+
.create(<FilterTab tabItem={tabs2} filterValue={() => 'M'} />)
|
|
39
|
+
.toJSON();
|
|
36
40
|
expect(tree).toMatchSnapshot();
|
|
37
41
|
});
|
|
38
42
|
});
|