@tactics/toddle-styleguide 1.2.1 → 1.2.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/App.d.ts +0 -1
- package/App.tsx +15 -7
- package/index.d.ts +3 -2
- package/index.tsx +4 -2
- package/package.json +30 -26
- package/src/components/atoms/animated-wave/animated-wave.component.d.ts +0 -1
- package/src/components/atoms/backdrop/backdrop.component.d.ts +0 -1
- package/src/components/atoms/background-gradient/background-gradient.component.d.ts +0 -1
- package/src/components/atoms/background-gradient/background-gradient.preview.d.ts +0 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +234 -234
- package/src/components/atoms/calendar/calendar.component.d.ts +0 -1
- package/src/components/atoms/calendar/calendar.component.tsx +8 -6
- package/src/components/atoms/calendar/calendar.preview.d.ts +0 -1
- package/src/components/atoms/check-switch/check-switch.component.d.ts +0 -1
- package/src/components/atoms/check-switch/check-switch.preview.d.ts +0 -1
- package/src/components/atoms/footer/footer.preview.d.ts +0 -1
- package/src/components/atoms/footer/footer.preview.tsx +0 -3
- package/src/components/atoms/heading-components/all-caps-heading/all-caps-heading.component.d.ts +0 -1
- package/src/components/atoms/heading-components/heading1/heading1.component.d.ts +0 -1
- package/src/components/atoms/heading-components/heading2/heading2.component.d.ts +0 -1
- package/src/components/atoms/heading-components/heading3/heading3.component.d.ts +0 -1
- package/src/components/atoms/heading-components/heading4/heading4.component.d.ts +0 -1
- package/src/components/atoms/heading-components/headings.preview.d.ts +0 -1
- package/src/components/atoms/image-bubble/image-bubble.component.d.ts +0 -1
- package/src/components/atoms/image-bubble/image-bubble.preview.d.ts +0 -1
- package/src/components/atoms/increment-input/increment-input.component.d.ts +0 -1
- package/src/components/atoms/increment-input/increment-input.preview.d.ts +0 -1
- package/src/components/atoms/logo/logo.component.d.ts +0 -1
- package/src/components/atoms/logo/logo.preview.d.ts +0 -1
- package/src/components/atoms/paragraph-components/paragraph/paragraph.component.d.ts +0 -1
- package/src/components/atoms/paragraph-components/paragraph-components.preview.d.ts +0 -1
- package/src/components/atoms/paragraph-components/small-text/small-text.component.d.ts +0 -1
- package/src/components/atoms/paragraph-components/tiny-text/tiny-text.component.d.ts +0 -1
- package/src/components/atoms/split-container/split-container.preview.d.ts +0 -1
- package/src/components/atoms/static-wave/static-wave.component.d.ts +0 -1
- package/src/components/atoms/text-input/text-input.component.d.ts +0 -1
- package/src/components/atoms/text-input/text-input.preview.d.ts +0 -1
- package/src/components/molecules/avatar/avatar.component.d.ts +0 -1
- package/src/components/molecules/avatar/avatar.preview.d.ts +0 -1
- package/src/components/molecules/blocked-message/blocked-message.component.d.ts +0 -1
- package/src/components/molecules/blocked-message/blocked-message.preview.d.ts +0 -1
- package/src/components/molecules/button/button.component.d.ts +0 -1
- package/src/components/molecules/button/button.preview.d.ts +0 -1
- package/src/components/molecules/calendar-select/calendar-select.component.d.ts +2 -3
- package/src/components/molecules/calendar-select/calendar-select.component.tsx +4 -14
- package/src/components/molecules/calendar-select/calendar-select.preview.d.ts +0 -1
- package/src/components/molecules/calendar-select/calendar-select.preview.tsx +9 -22
- package/src/components/molecules/cancel-link/cancel-link.component.d.ts +0 -1
- package/src/components/molecules/cancel-link/cancel-link.preview.d.ts +0 -1
- package/src/components/molecules/checkbox/checkbox.component.d.ts +0 -1
- package/src/components/molecules/checkbox/checkbox.preview.d.ts +0 -1
- package/src/components/molecules/contact-role/contact-role.component.d.ts +0 -1
- package/src/components/molecules/contact-role/contact-role.preview.d.ts +0 -1
- package/src/components/molecules/date-input/date-input.component.d.ts +0 -1
- package/src/components/molecules/date-input/date-input.preview.d.ts +0 -1
- package/src/components/molecules/day/day.component.d.ts +0 -1
- package/src/components/molecules/default-select/default-select.component.d.ts +0 -1
- package/src/components/molecules/default-select/default-select.preview.d.ts +0 -1
- package/src/components/molecules/department_logo/department-logo.component.d.ts +0 -1
- package/src/components/molecules/department_logo/department-logo.preview.d.ts +0 -1
- package/src/components/molecules/failed-to-send/failed-bubble.component.d.ts +0 -1
- package/src/components/molecules/filter-range/filter-range.component.d.ts +0 -1
- package/src/components/molecules/filter-range/filter-range.preview.d.ts +0 -1
- package/src/components/molecules/filter-tab/filter-tab.component.d.ts +0 -1
- package/src/components/molecules/filter-tab/filter-tab.preview.d.ts +0 -1
- package/src/components/molecules/info/info.component.d.ts +0 -1
- package/src/components/molecules/info/info.preview.d.ts +0 -1
- package/src/components/molecules/language-button/language-button.component.d.ts +0 -1
- package/src/components/molecules/language-button/language-button.preview.d.ts +0 -1
- package/src/components/molecules/message-input/message-input.component.d.ts +0 -1
- package/src/components/molecules/message-input/message-input.preview.d.ts +0 -1
- package/src/components/molecules/more-info-button/more-info-button.component.d.ts +0 -1
- package/src/components/molecules/more-info-button/more-info-button.preview.d.ts +0 -1
- package/src/components/molecules/password-input/password-input.component.d.ts +0 -1
- package/src/components/molecules/password-input/password-input.preview.d.ts +0 -1
- package/src/components/molecules/pill/pill.component.d.ts +0 -1
- package/src/components/molecules/pill/pill.preview.d.ts +0 -1
- package/src/components/molecules/pressable-icon/pressable-icon.preview.d.ts +0 -1
- package/src/components/molecules/quick-filter/quick-filter.component.d.ts +0 -1
- package/src/components/molecules/quick-filter/quick-filter.preview.d.ts +0 -1
- package/src/components/molecules/search-input/search.component.d.ts +0 -1
- package/src/components/molecules/search-input/search.preview.d.ts +0 -1
- package/src/components/molecules/select-link/select-link.component.d.ts +0 -1
- package/src/components/molecules/select-link/select-link.preview.d.ts +0 -1
- package/src/components/molecules/select-list-item/select-list-item-preview.d.ts +0 -1
- package/src/components/molecules/select-picker/select-picker.component.d.ts +0 -1
- package/src/components/molecules/select-picker/select-picker.preview.d.ts +0 -1
- package/src/components/molecules/send-bubble/send-text-bubble.component.d.ts +0 -1
- package/src/components/molecules/snackbar/snackbar.component.d.ts +0 -1
- package/src/components/molecules/snackbar/snackbar.preview.d.ts +0 -1
- package/src/components/molecules/swipe/swipe.preview.d.ts +0 -1
- package/src/components/molecules/tag/tag.component.d.ts +0 -1
- package/src/components/molecules/tag/tag.preview.d.ts +0 -1
- package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +2149 -0
- package/src/components/molecules/time-picker/time-picker.component.d.ts +8 -0
- package/src/components/molecules/time-picker/time-picker.component.tsx +65 -0
- package/src/components/molecules/time-picker/time-picker.preview.d.ts +1 -0
- package/src/components/molecules/time-picker/time-picker.preview.tsx +109 -0
- package/src/components/molecules/time-picker/time-picker.styles.d.ts +15 -0
- package/src/components/molecules/time-picker/time-picker.styles.js +19 -0
- package/src/components/molecules/time-picker/time-picker.test.js +18 -0
- package/src/components/molecules/time-tracker/time-tracker.component.d.ts +0 -1
- package/src/components/molecules/time-tracker/time-tracker.preview.d.ts +0 -1
- package/src/components/molecules/time-tracker/time-tracker.test.js +0 -1
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +47 -39
- package/src/components/molecules/timeline/timeline.component.d.ts +2 -3
- package/src/components/molecules/timeline/timeline.component.tsx +27 -120
- package/src/components/molecules/timeline/timeline.preview.d.ts +0 -1
- package/src/components/molecules/timeline/timeline.preview.tsx +9 -20
- package/src/components/molecules/timeline/timeline.styles.d.ts +58 -40
- package/src/components/molecules/timeline/timeline.styles.js +24 -17
- package/src/components/molecules/timeline/timeline.test.js +3 -3
- package/src/components/molecules/timestamp/timestamp.component.d.ts +0 -1
- package/src/components/molecules/wave-background/wave.component.d.ts +0 -1
- package/src/components/molecules/wave-background/wave.preview.d.ts +0 -1
- package/src/components/molecules/wide-button/wide-button.component.d.ts +0 -1
- package/src/components/molecules/wide-button/wide-button.preview.d.ts +0 -1
- package/src/components/organisms/child-list-item/child-list-item.preview.d.ts +0 -1
- package/src/components/organisms/contact-item/contact-item.component.d.ts +0 -1
- package/src/components/organisms/contact-item/contact-item.preview.d.ts +0 -1
- package/src/components/organisms/day-select/day-select.component.d.ts +0 -1
- package/src/components/organisms/day-select/day-select.preview.d.ts +0 -1
- package/src/components/organisms/loading-indicator/container.component.d.ts +0 -1
- package/src/components/organisms/loading-indicator/dot.component.d.ts +0 -1
- package/src/components/organisms/loading-indicator/loading-indicator.component.d.ts +0 -1
- package/src/components/organisms/loading-indicator/loading-indicator.preview.d.ts +0 -1
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +0 -1
- package/src/components/organisms/my-child-list-item/my-child-list-item.preview.d.ts +0 -1
- package/src/components/organisms/person-info-card/person-info-card.component.d.ts +0 -1
- package/src/components/organisms/person-info-card/person-info-card.preview.d.ts +0 -1
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +0 -1
- package/src/components/organisms/text-bubble/text-bubble.preview.d.ts +0 -1
- package/src/components/templates/modal/components/fade-panel.component.d.ts +2 -1
- package/src/components/templates/modal/components/fade-panel.component.tsx +8 -2
- package/src/components/templates/modal/modal.component.d.ts +2 -1
- package/src/components/templates/modal/modal.component.tsx +4 -3
- package/src/components/templates/modal/modal.preview.d.ts +0 -1
- package/src/components/templates/modal/modal.styles.d.ts +3 -6
- package/src/components/templates/modal/modal.styles.js +3 -3
- package/src/components/templates/popover/components/modal/close/close.component.d.ts +0 -1
- package/src/components/templates/popover/components/modal/heading/heading.component.d.ts +0 -1
- package/src/components/templates/popover/components/modal/modal.component.tsx +0 -2
- package/src/components/templates/popover/popover.preview.d.ts +0 -1
- package/src/gradients/main/main.gradient.d.ts +0 -1
- package/src/icons/index.d.ts +0 -1
- package/src/icons/outline/calendar/calendar.icon.d.ts +0 -1
- package/src/icons/outline/chat/chat.icon.d.ts +0 -1
- package/src/icons/outline/chat-alt/chat-alt.icon.d.ts +0 -1
- package/src/icons/outline/check-circle/check-circle.icon.d.ts +0 -1
- package/src/icons/outline/chevron-left/chevron-left.icon.d.ts +0 -1
- package/src/icons/outline/chevron-right/chevron-right.icon.d.ts +0 -1
- package/src/icons/outline/clock/clock.icon.d.ts +0 -1
- package/src/icons/outline/cloud-download/cloud-download.icon.d.ts +0 -1
- package/src/icons/outline/currency-euro/currency-euro.icon.d.ts +0 -1
- package/src/icons/outline/document-text/document-text.icon.d.ts +0 -1
- package/src/icons/outline/exclamation/exclamation.icon.d.ts +0 -1
- package/src/icons/outline/exclamation-circle/exclamation-circle.icon.d.ts +0 -1
- package/src/icons/outline/eye/eye.icon.d.ts +0 -1
- package/src/icons/outline/eye-off/eye-off.icon.d.ts +0 -1
- package/src/icons/outline/filter/filter.icon.d.ts +0 -1
- package/src/icons/outline/information-circle/information-circle.icon.d.ts +0 -1
- package/src/icons/outline/logout/logout.icon.d.ts +0 -1
- package/src/icons/outline/mail/mail.icon.d.ts +0 -1
- package/src/icons/outline/mail-open/mail-open.icon.d.ts +0 -1
- package/src/icons/outline/menu/menu.icon.d.ts +0 -1
- package/src/icons/outline/minus-sm/minus-sm.icon.d.ts +0 -1
- package/src/icons/outline/office-building/office-building.icon.d.ts +0 -1
- package/src/icons/outline/outline-default.preview.d.ts +0 -1
- package/src/icons/outline/outline-grey.preview.d.ts +0 -1
- package/src/icons/outline/outline-white.preview.d.ts +0 -1
- package/src/icons/outline/outline.d.ts +0 -1
- package/src/icons/outline/paper-airplane/paper-airplane.icon.d.ts +0 -1
- package/src/icons/outline/paperclip/paperclip.icon.d.ts +0 -1
- package/src/icons/outline/pencil/pencil.icon.d.ts +0 -1
- package/src/icons/outline/phone/phone.icon.d.ts +0 -1
- package/src/icons/outline/plus/plus.icon.d.ts +0 -1
- package/src/icons/outline/plus-sm/plus-sm.icon.d.ts +0 -1
- package/src/icons/outline/qrcode/qrcode.icon.d.ts +0 -1
- package/src/icons/outline/refresh/refresh.icon.d.ts +0 -1
- package/src/icons/outline/search/search.icon.d.ts +0 -1
- package/src/icons/outline/selector/selector.icon.d.ts +0 -1
- package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.d.ts +0 -1
- package/src/icons/outline/status-online/status-online.icon.d.ts +0 -1
- package/src/icons/outline/thumb-up/thumb-up.icon.d.ts +0 -1
- package/src/icons/outline/trash/trash.icon.d.ts +0 -1
- package/src/icons/outline/user/user.icon.d.ts +0 -1
- package/src/icons/outline/user-group/user-group.icon.d.ts +0 -1
- package/src/icons/outline/users/users.icon.d.ts +0 -1
- package/src/icons/outline/xmark/xmark.icon.d.ts +0 -1
- package/src/icons/solid/calendar/calendar.icon.d.ts +0 -1
- package/src/icons/solid/chat/chat.icon.d.ts +0 -1
- package/src/icons/solid/chat-alt/chat-alt-solid.icon.d.ts +0 -1
- package/src/icons/solid/check-circle/check-circle.icon.d.ts +0 -1
- package/src/icons/solid/chevron-left/chevron-left.icon.d.ts +0 -1
- package/src/icons/solid/chevron-right/chevron-right.icon.d.ts +0 -1
- package/src/icons/solid/clock/clock-solid.icon.d.ts +0 -1
- package/src/icons/solid/cloud-download/cloud-download.icon.d.ts +0 -1
- package/src/icons/solid/currency-euro/currency-euro.icon.d.ts +0 -1
- package/src/icons/solid/document-text/document-text-solid.icon.d.ts +0 -1
- package/src/icons/solid/exclamation/exclamation.icon.d.ts +0 -1
- package/src/icons/solid/exclamation-circle/exclamation-circle.icon.d.ts +0 -1
- package/src/icons/solid/eye/eye.icon.d.ts +0 -1
- package/src/icons/solid/eye-off/eye-off.icon.d.ts +0 -1
- package/src/icons/solid/filter/filter.icon.d.ts +0 -1
- package/src/icons/solid/information-circle/information-circle-solid.icon.d.ts +0 -1
- package/src/icons/solid/logout/logout.icon.d.ts +0 -1
- package/src/icons/solid/mail/mail.icon.d.ts +0 -1
- package/src/icons/solid/mail-open/mail-open.icon.d.ts +0 -1
- package/src/icons/solid/menu/menu.icon.d.ts +0 -1
- package/src/icons/solid/minus-sm/minus-sm.icon.d.ts +0 -1
- package/src/icons/solid/office-building/office-building.icon.d.ts +0 -1
- package/src/icons/solid/paper-airplane/paper-airplane.icon.d.ts +0 -1
- package/src/icons/solid/paperclip/paperclip.icon.d.ts +0 -1
- package/src/icons/solid/pencil/pencil-solid.icon.d.ts +0 -1
- package/src/icons/solid/phone/phone-solid.icon.d.ts +0 -1
- package/src/icons/solid/plus/plus.icon.d.ts +0 -1
- package/src/icons/solid/plus-sm/plus-sm.icon.d.ts +0 -1
- package/src/icons/solid/qrcode/qrcode.icon.d.ts +0 -1
- package/src/icons/solid/refresh/refresh-solid.icon.d.ts +0 -1
- package/src/icons/solid/search/search.icon.d.ts +0 -1
- package/src/icons/solid/selector/selector.icon.d.ts +0 -1
- package/src/icons/solid/sm-view-grid-add/sm-view-grid-add.icon.d.ts +0 -1
- package/src/icons/solid/solid.d.ts +0 -1
- package/src/icons/solid/solid.preview.d.ts +0 -1
- package/src/icons/solid/status-online/status-online-solid.icon.d.ts +0 -1
- package/src/icons/solid/thumb-up/thumb-up.icon.d.ts +0 -1
- package/src/icons/solid/trash/trash-solid.icon.d.ts +0 -1
- package/src/icons/solid/user/user.icon.d.ts +0 -1
- package/src/icons/solid/user-group/user-group.icon.d.ts +0 -1
- package/src/icons/solid/users/users-solid.icon.d.ts +0 -1
- package/src/icons/solid/xmark/xmark.icon.d.ts +0 -1
- package/src/theme/provider/parent.theme.d.ts +4 -1
- package/src/theme/provider/parent.theme.ts +4 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +2 -2
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +2 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.d.ts +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TimePickerProps {
|
|
2
|
+
initialHours: string;
|
|
3
|
+
initialMinutes: string;
|
|
4
|
+
onChangeHours: (value: string) => void;
|
|
5
|
+
onChangeMinutes: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const TimePicker: ({ initialHours, initialMinutes, onChangeHours, onChangeMinutes, }: TimePickerProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {View} from 'react-native';
|
|
2
|
+
import WheelPickerExpo from 'react-native-wheel-picker-expo';
|
|
3
|
+
import {Heading3} from '../../atoms/heading-components';
|
|
4
|
+
import {Stylesheet} from './time-picker.styles';
|
|
5
|
+
import {Scale} from '../../../theme/scale/index';
|
|
6
|
+
import {useContext} from 'react';
|
|
7
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
8
|
+
|
|
9
|
+
interface TimePickerProps {
|
|
10
|
+
initialHours: string;
|
|
11
|
+
initialMinutes: string;
|
|
12
|
+
onChangeHours: (value: string) => void;
|
|
13
|
+
onChangeMinutes: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const HOURS: string[] = [
|
|
17
|
+
'--',
|
|
18
|
+
...Array.from({length: 24}, (_, i) => i.toString().padStart(2, '0')),
|
|
19
|
+
];
|
|
20
|
+
const MINUTES: string[] = [
|
|
21
|
+
'--',
|
|
22
|
+
...Array.from({length: 60}, (_, i) => i.toString().padStart(2, '0')),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const TimePicker = ({
|
|
26
|
+
initialHours,
|
|
27
|
+
initialMinutes,
|
|
28
|
+
onChangeHours,
|
|
29
|
+
onChangeMinutes,
|
|
30
|
+
}: TimePickerProps) => {
|
|
31
|
+
const context = useContext(ThemeCtx);
|
|
32
|
+
const styles = Stylesheet(context);
|
|
33
|
+
|
|
34
|
+
const initialIndexHandler = (dataArray: string[], value: string): number => {
|
|
35
|
+
return dataArray.findIndex((element) => element === value);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<View style={styles.container}>
|
|
40
|
+
<WheelPickerExpo
|
|
41
|
+
items={HOURS.map((value) => ({label: value, value: value}))}
|
|
42
|
+
onChange={({item}) => onChangeHours(item.label)}
|
|
43
|
+
width={Scale.m * 4.5}
|
|
44
|
+
selectedStyle={styles.selected}
|
|
45
|
+
renderItem={({label, textAlign}) => (
|
|
46
|
+
<Heading3 textAlign={textAlign}>{label}</Heading3>
|
|
47
|
+
)}
|
|
48
|
+
initialSelectedIndex={initialIndexHandler(HOURS, initialHours)}
|
|
49
|
+
/>
|
|
50
|
+
<View>
|
|
51
|
+
<Heading3>:</Heading3>
|
|
52
|
+
</View>
|
|
53
|
+
<WheelPickerExpo
|
|
54
|
+
items={MINUTES.map((value) => ({label: value, value: value}))}
|
|
55
|
+
onChange={({item}) => onChangeMinutes(item.label)}
|
|
56
|
+
width={Scale.m * 4.5}
|
|
57
|
+
selectedStyle={styles.selected}
|
|
58
|
+
renderItem={({label, textAlign}) => (
|
|
59
|
+
<Heading3 textAlign={textAlign}>{label}</Heading3>
|
|
60
|
+
)}
|
|
61
|
+
initialSelectedIndex={initialIndexHandler(MINUTES, initialMinutes)}
|
|
62
|
+
/>
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TimePickerPreview: ({}: {}) => JSX.Element;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {TimePicker} from './time-picker.component';
|
|
4
|
+
import {Heading3} from '../../atoms/heading-components';
|
|
5
|
+
import {Button} from '../button/button.component';
|
|
6
|
+
import {Avatar} from '../avatar/avatar.component';
|
|
7
|
+
import {Initials} from '../../../models/initials.model';
|
|
8
|
+
import {Size} from '../../../types/size.enum';
|
|
9
|
+
import {Modal} from '../../templates/modal/modal.component';
|
|
10
|
+
|
|
11
|
+
export const TimePickerPreview = ({}: {}) => {
|
|
12
|
+
const [popoverIsVisible, setPopoverIsVisible] = useState(false);
|
|
13
|
+
|
|
14
|
+
const [checkInHours, setCheckInHours] = useState('09');
|
|
15
|
+
const [checkInMinutes, setCheckInMinutes] = useState('06');
|
|
16
|
+
|
|
17
|
+
const [checkOutHours, setCheckOutHours] = useState('--');
|
|
18
|
+
const [checkOutMinutes, setCheckOutMinutes] = useState('--');
|
|
19
|
+
|
|
20
|
+
console.log(`
|
|
21
|
+
Check In:
|
|
22
|
+
Hours: ${checkInHours}
|
|
23
|
+
Minutes: ${checkInMinutes}
|
|
24
|
+
|
|
25
|
+
Check Out:
|
|
26
|
+
Hours: ${checkOutHours}
|
|
27
|
+
Minutes: ${checkOutMinutes}
|
|
28
|
+
`);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={{
|
|
33
|
+
width: '100%',
|
|
34
|
+
height: '100%',
|
|
35
|
+
zIndex: 10000,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<View
|
|
39
|
+
style={{
|
|
40
|
+
marginTop: 150,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Button
|
|
44
|
+
onPress={() => setPopoverIsVisible(true)}
|
|
45
|
+
label="Open popover"
|
|
46
|
+
/>
|
|
47
|
+
</View>
|
|
48
|
+
<Modal
|
|
49
|
+
title={'Zeno Driesennnnnnnnnnnnnnnnn'}
|
|
50
|
+
subtitle={'Registratie aanpassen'}
|
|
51
|
+
onClose={() => setPopoverIsVisible(false)}
|
|
52
|
+
isVisible={popoverIsVisible}
|
|
53
|
+
scrollable={false}
|
|
54
|
+
>
|
|
55
|
+
<View>
|
|
56
|
+
<View style={{alignItems: 'center', marginBottom: 16}}>
|
|
57
|
+
<Avatar
|
|
58
|
+
source={Initials.for('Zeno', 'Driesen')}
|
|
59
|
+
size={Size.LARGE}
|
|
60
|
+
/>
|
|
61
|
+
</View>
|
|
62
|
+
<View
|
|
63
|
+
style={{
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
justifyContent: 'space-between',
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<View>
|
|
69
|
+
<Heading3
|
|
70
|
+
bold={true}
|
|
71
|
+
textAlign={'center'}
|
|
72
|
+
addStyle={{marginBottom: 8}}
|
|
73
|
+
>
|
|
74
|
+
Check In
|
|
75
|
+
</Heading3>
|
|
76
|
+
<TimePicker
|
|
77
|
+
initialHours={checkInHours}
|
|
78
|
+
initialMinutes={checkInMinutes}
|
|
79
|
+
onChangeHours={setCheckInHours}
|
|
80
|
+
onChangeMinutes={setCheckInMinutes}
|
|
81
|
+
/>
|
|
82
|
+
</View>
|
|
83
|
+
<View>
|
|
84
|
+
<Heading3
|
|
85
|
+
bold={true}
|
|
86
|
+
textAlign={'center'}
|
|
87
|
+
addStyle={{marginBottom: 8}}
|
|
88
|
+
>
|
|
89
|
+
Check Out
|
|
90
|
+
</Heading3>
|
|
91
|
+
<TimePicker
|
|
92
|
+
initialHours={checkOutHours}
|
|
93
|
+
initialMinutes={checkOutMinutes}
|
|
94
|
+
onChangeHours={setCheckOutHours}
|
|
95
|
+
onChangeMinutes={setCheckOutMinutes}
|
|
96
|
+
/>
|
|
97
|
+
</View>
|
|
98
|
+
</View>
|
|
99
|
+
<View style={{marginTop: 32, marginBottom: 16, alignItems: 'center'}}>
|
|
100
|
+
<Button
|
|
101
|
+
label={'Bewaar'}
|
|
102
|
+
onPress={() => console.log('Bewaar registratie aanpassing')}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
</View>
|
|
106
|
+
</Modal>
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function Stylesheet(context: any): {
|
|
2
|
+
container: {
|
|
3
|
+
borderColor: any;
|
|
4
|
+
borderWidth: number;
|
|
5
|
+
borderStyle: 'solid';
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
overflow: 'hidden';
|
|
8
|
+
flexDirection: 'row';
|
|
9
|
+
alignItems: 'center';
|
|
10
|
+
};
|
|
11
|
+
selected: {
|
|
12
|
+
borderColor: any;
|
|
13
|
+
borderWidth: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Scale} from '../../../theme/scale/index';
|
|
3
|
+
|
|
4
|
+
export const Stylesheet = (context) =>
|
|
5
|
+
StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
borderColor: context.colors.ui.xlightgrey,
|
|
8
|
+
borderWidth: 1,
|
|
9
|
+
borderStyle: 'solid',
|
|
10
|
+
borderRadius: Scale.m,
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
},
|
|
15
|
+
selected: {
|
|
16
|
+
borderColor: context.colors.ui.lightgrey,
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import renderer from 'react-test-renderer';
|
|
2
|
+
import {TimePicker} from './time-picker.component';
|
|
3
|
+
|
|
4
|
+
describe('Time picker test', () => {
|
|
5
|
+
it('Should render a time picker where we can choose the hours and minutes separately, and our initial set time is 08:00', () => {
|
|
6
|
+
const tree = renderer
|
|
7
|
+
.create(
|
|
8
|
+
<TimePicker
|
|
9
|
+
initialHours={'08'}
|
|
10
|
+
initialMinutes={'00'}
|
|
11
|
+
onChangeHours={() => console.log('set the hours')}
|
|
12
|
+
onChangeMinutes={() => console.log('set the minutes')}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
.toJSON();
|
|
16
|
+
expect(tree).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import {TimeTracker} from './time-tracker.component';
|
|
4
|
-
import render from 'react-test-renderer';
|
|
5
4
|
|
|
6
5
|
describe('test time-tracker', () => {
|
|
7
6
|
it('given the visualState is DEFAULT return a blue colored ball', () => {
|
|
@@ -4,6 +4,8 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
{
|
|
7
|
+
"marginBottom": 8,
|
|
8
|
+
"marginTop": 8,
|
|
7
9
|
"width": "100%",
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -14,6 +16,7 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
|
|
|
14
16
|
"backgroundColor": "#E5E8EB",
|
|
15
17
|
"borderRadius": 50,
|
|
16
18
|
"height": 8,
|
|
19
|
+
"overflow": "hidden",
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
>
|
|
@@ -36,35 +39,36 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
style={
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
"width": "40%",
|
|
47
|
-
},
|
|
48
|
-
]
|
|
42
|
+
{
|
|
43
|
+
"borderRadius": 50,
|
|
44
|
+
"height": 8,
|
|
45
|
+
"left": "10%",
|
|
46
|
+
"width": "33.333333333333336%",
|
|
47
|
+
}
|
|
49
48
|
}
|
|
50
49
|
/>
|
|
51
50
|
</View>
|
|
52
51
|
<View
|
|
53
52
|
style={
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
[
|
|
54
|
+
{
|
|
55
|
+
"flexDirection": "row",
|
|
56
|
+
"height": 24,
|
|
57
|
+
"marginTop": 8,
|
|
58
|
+
"width": "33.333333333333336%",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"justifyContent": "space-between",
|
|
62
|
+
"marginLeft": "10%",
|
|
63
|
+
},
|
|
64
|
+
false,
|
|
65
|
+
]
|
|
62
66
|
}
|
|
63
67
|
>
|
|
64
68
|
<View
|
|
65
69
|
style={
|
|
66
70
|
{
|
|
67
|
-
"right":
|
|
71
|
+
"right": 16,
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
>
|
|
@@ -93,7 +97,7 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
|
|
|
93
97
|
<View
|
|
94
98
|
style={
|
|
95
99
|
{
|
|
96
|
-
"left":
|
|
100
|
+
"left": 16,
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
>
|
|
@@ -127,6 +131,8 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
|
|
|
127
131
|
<View
|
|
128
132
|
style={
|
|
129
133
|
{
|
|
134
|
+
"marginBottom": 8,
|
|
135
|
+
"marginTop": 8,
|
|
130
136
|
"width": "100%",
|
|
131
137
|
}
|
|
132
138
|
}
|
|
@@ -137,6 +143,7 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
|
|
|
137
143
|
"backgroundColor": "#E5E8EB",
|
|
138
144
|
"borderRadius": 50,
|
|
139
145
|
"height": 8,
|
|
146
|
+
"overflow": "hidden",
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
149
|
>
|
|
@@ -159,35 +166,36 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
|
|
|
159
166
|
}
|
|
160
167
|
}
|
|
161
168
|
style={
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
"width": "35%",
|
|
170
|
-
},
|
|
171
|
-
]
|
|
169
|
+
{
|
|
170
|
+
"borderRadius": 50,
|
|
171
|
+
"height": 8,
|
|
172
|
+
"left": "10%",
|
|
173
|
+
"width": "25%",
|
|
174
|
+
}
|
|
172
175
|
}
|
|
173
176
|
/>
|
|
174
177
|
</View>
|
|
175
178
|
<View
|
|
176
179
|
style={
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
[
|
|
181
|
+
{
|
|
182
|
+
"flexDirection": "row",
|
|
183
|
+
"height": 24,
|
|
184
|
+
"marginTop": 8,
|
|
185
|
+
"width": "25%",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"justifyContent": "space-between",
|
|
189
|
+
"marginLeft": "10%",
|
|
190
|
+
},
|
|
191
|
+
false,
|
|
192
|
+
]
|
|
185
193
|
}
|
|
186
194
|
>
|
|
187
195
|
<View
|
|
188
196
|
style={
|
|
189
197
|
{
|
|
190
|
-
"right":
|
|
198
|
+
"right": 16,
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
201
|
>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
type TimelineProps = {
|
|
1
|
+
type TimeLineProps = {
|
|
3
2
|
checkIn: string;
|
|
4
3
|
checkOut?: string;
|
|
5
4
|
};
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const TimeLine: ({ checkIn, checkOut }: TimeLineProps) => JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -5,132 +5,42 @@ import {Stylesheet} from './timeline.styles';
|
|
|
5
5
|
import {LinearGradient} from 'expo-linear-gradient';
|
|
6
6
|
import {SmallText} from '../../atoms/paragraph-components';
|
|
7
7
|
|
|
8
|
-
type
|
|
8
|
+
type TimeLineProps = {
|
|
9
9
|
checkIn: string;
|
|
10
10
|
checkOut?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const
|
|
14
|
-
|
|
13
|
+
export const TimeLine = ({checkIn, checkOut}: TimeLineProps) => {
|
|
14
|
+
const startHour = 6;
|
|
15
|
+
const endHour = 21;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
position = 4;
|
|
23
|
-
} else if (prop < '07:30') {
|
|
24
|
-
position = 6;
|
|
25
|
-
} else if (prop === '07:30') {
|
|
26
|
-
position = 8;
|
|
27
|
-
} else if (prop < '08:00') {
|
|
28
|
-
position = 10;
|
|
29
|
-
} else if (prop === '08:00') {
|
|
30
|
-
position = 12;
|
|
31
|
-
} else if (prop < '08:30') {
|
|
32
|
-
position = 14;
|
|
33
|
-
} else if (prop === '08:30') {
|
|
34
|
-
position = 16;
|
|
35
|
-
} else if (prop < '09:00') {
|
|
36
|
-
position = 18;
|
|
37
|
-
} else if (prop === '09:00') {
|
|
38
|
-
position = 20;
|
|
39
|
-
} else if (prop < '09:30') {
|
|
40
|
-
position = 22;
|
|
41
|
-
} else if (prop === '09:30') {
|
|
42
|
-
position = 24;
|
|
43
|
-
} else if (prop < '10:00') {
|
|
44
|
-
position = 26;
|
|
45
|
-
} else if (prop === '10:00') {
|
|
46
|
-
position = 28;
|
|
47
|
-
} else if (prop < '10:30') {
|
|
48
|
-
position = 30;
|
|
49
|
-
} else if (prop === '10:30') {
|
|
50
|
-
position = 32;
|
|
51
|
-
} else if (prop < '11:00') {
|
|
52
|
-
position = 34;
|
|
53
|
-
} else if (prop === '11:00') {
|
|
54
|
-
position = 36;
|
|
55
|
-
} else if (prop < '11:30') {
|
|
56
|
-
position = 38;
|
|
57
|
-
} else if (prop === '11:30') {
|
|
58
|
-
position = 40;
|
|
59
|
-
} else if (prop < '12:00') {
|
|
60
|
-
position = 42;
|
|
61
|
-
} else if (prop === '12:00') {
|
|
62
|
-
position = 44;
|
|
63
|
-
} else if (prop < '12:30') {
|
|
64
|
-
position = 46;
|
|
65
|
-
} else if (prop === '12:30') {
|
|
66
|
-
position = 48;
|
|
67
|
-
} else if (prop < '13:00') {
|
|
68
|
-
position = 50;
|
|
69
|
-
} else if (prop === '13:00') {
|
|
70
|
-
position = 52;
|
|
71
|
-
} else if (prop < '13:30') {
|
|
72
|
-
position = 54;
|
|
73
|
-
} else if (prop === '13:30') {
|
|
74
|
-
position = 56;
|
|
75
|
-
} else if (prop < '14:00') {
|
|
76
|
-
position = 58;
|
|
77
|
-
} else if (prop === '14:00') {
|
|
78
|
-
position = 60;
|
|
79
|
-
} else if (prop < '14:30') {
|
|
80
|
-
position = 62;
|
|
81
|
-
} else if (prop === '14:30') {
|
|
82
|
-
position = 64;
|
|
83
|
-
} else if (prop < '15:00') {
|
|
84
|
-
position = 66;
|
|
85
|
-
} else if (prop === '15:00') {
|
|
86
|
-
position = 68;
|
|
87
|
-
} else if (prop < '15:30') {
|
|
88
|
-
position = 70;
|
|
89
|
-
} else if (prop === '15:30') {
|
|
90
|
-
position = 72;
|
|
91
|
-
} else if (prop < '16:00') {
|
|
92
|
-
position = 74;
|
|
93
|
-
} else if (prop === '16:00') {
|
|
94
|
-
position = 76;
|
|
95
|
-
} else if (prop < '16:30') {
|
|
96
|
-
position = 78;
|
|
97
|
-
} else if (prop === '16:30') {
|
|
98
|
-
position = 80;
|
|
99
|
-
} else if (prop < '17:00') {
|
|
100
|
-
position = 82;
|
|
101
|
-
} else if (prop === '17:00') {
|
|
102
|
-
position = 84;
|
|
103
|
-
} else if (prop < '17:30') {
|
|
104
|
-
position = 86;
|
|
105
|
-
} else if (prop === '17:30') {
|
|
106
|
-
position = 88;
|
|
107
|
-
} else if (prop < '18:00') {
|
|
108
|
-
position = 90;
|
|
109
|
-
} else if (prop === '18:00') {
|
|
110
|
-
position = 92;
|
|
111
|
-
} else if (prop < '18:30') {
|
|
112
|
-
position = 94;
|
|
113
|
-
} else if (prop === '18:30') {
|
|
114
|
-
position = 96;
|
|
115
|
-
} else if (prop < '19:00') {
|
|
116
|
-
position = 98;
|
|
117
|
-
} else if (prop === '19:00') {
|
|
118
|
-
position = 100;
|
|
119
|
-
}
|
|
120
|
-
return position;
|
|
121
|
-
}
|
|
17
|
+
const calculateCheckInPosition = (checkInTime: string) => {
|
|
18
|
+
const [hours, minutes] = checkInTime.split(':');
|
|
19
|
+
const totalMinutes =
|
|
20
|
+
parseInt(hours) * 60 + parseInt(minutes) - startHour * 60;
|
|
21
|
+
return (totalMinutes / ((endHour - startHour) * 60)) * 100;
|
|
22
|
+
};
|
|
122
23
|
|
|
123
|
-
const
|
|
124
|
-
|
|
24
|
+
const calculateCheckOutPosition = (checkOutTime?: string) => {
|
|
25
|
+
if (checkOutTime) {
|
|
26
|
+
const [hours, minutes] = checkOutTime.split(':');
|
|
27
|
+
const totalMinutes =
|
|
28
|
+
parseInt(hours) * 60 + parseInt(minutes) - startHour * 60;
|
|
29
|
+
return (totalMinutes / ((endHour - startHour) * 60)) * 100;
|
|
30
|
+
}
|
|
31
|
+
return 25;
|
|
32
|
+
};
|
|
125
33
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
34
|
+
const checkInPosition = calculateCheckInPosition(checkIn);
|
|
35
|
+
const checkOutPosition = calculateCheckOutPosition(checkOut);
|
|
129
36
|
|
|
130
|
-
const
|
|
37
|
+
const gradientWidth =
|
|
38
|
+
checkOut && checkOutPosition !== checkInPosition
|
|
39
|
+
? checkOutPosition - checkInPosition
|
|
40
|
+
: 25;
|
|
131
41
|
|
|
132
42
|
const context = useContext(ThemeCtx);
|
|
133
|
-
const styles = Stylesheet(context, checkInPosition,
|
|
43
|
+
const styles = Stylesheet(context, checkInPosition, gradientWidth);
|
|
134
44
|
|
|
135
45
|
return (
|
|
136
46
|
<View style={styles.container}>
|
|
@@ -141,10 +51,7 @@ export const Timeline = ({checkIn, checkOut}: TimelineProps) => {
|
|
|
141
51
|
? [context.colors.main['5'], context.colors.ui.lightgrey]
|
|
142
52
|
: [context.colors.main['5'], context.colors.main['5']]
|
|
143
53
|
}
|
|
144
|
-
style={
|
|
145
|
-
styles.checkInLine,
|
|
146
|
-
!checkOut ? styles.checkInWidth : styles.checkOutWidth,
|
|
147
|
-
]}
|
|
54
|
+
style={styles.checkInLine}
|
|
148
55
|
start={{x: 0, y: 0}}
|
|
149
56
|
end={{x: 1, y: 0}}
|
|
150
57
|
/>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {SafeAreaView, ScrollView} from 'react-native';
|
|
2
|
+
import {TimeLine} from './timeline.component';
|
|
4
3
|
const {View} = require('react-native');
|
|
5
4
|
|
|
6
5
|
export const TimeLinePreview = ({}: {}) => {
|
|
@@ -19,24 +18,14 @@ export const TimeLinePreview = ({}: {}) => {
|
|
|
19
18
|
justifyContent: 'center',
|
|
20
19
|
}}
|
|
21
20
|
>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
<Timeline checkIn={'13:30'} checkOut={'19:00'} />
|
|
33
|
-
<Timeline checkIn={'09:00'} checkOut={'17:30'} />
|
|
34
|
-
<Timeline checkIn={'07:12'} />
|
|
35
|
-
<Timeline checkIn={'06:30'} checkOut={'19:00'} />
|
|
36
|
-
</View>
|
|
37
|
-
<Timeline checkIn={'08:17'} />
|
|
38
|
-
<Timeline checkIn={'07:52'} checkOut={'12:20'} />
|
|
39
|
-
<Timeline checkIn={'13:00'} checkOut={'17:45'} />
|
|
21
|
+
<TimeLine checkIn={'07:00'} checkOut={'12:00'} />
|
|
22
|
+
<TimeLine checkIn={'08:00'} checkOut={'12:30'} />
|
|
23
|
+
<TimeLine checkIn={'13:00'} checkOut={''} />
|
|
24
|
+
<TimeLine checkIn={'16:00'} checkOut={'21:00'} />
|
|
25
|
+
<TimeLine checkIn={'07:52'} checkOut={'12:20'} />
|
|
26
|
+
<TimeLine checkIn={'13:00'} checkOut={'17:45'} />
|
|
27
|
+
<TimeLine checkIn={'18:00'} />
|
|
28
|
+
<TimeLine checkIn={'15:00'} checkOut={'20:00'} />
|
|
40
29
|
</View>
|
|
41
30
|
</View>
|
|
42
31
|
);
|