@mindly/ui-components 3.1.4 → 3.1.5
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/dist/fonts/Lato-Bold.ttf +0 -0
- package/dist/fonts/Lato-Regular.ttf +0 -0
- package/dist/fonts/Lato-Semibold.ttf +0 -0
- package/dist/index.ts +106 -0
- package/dist/lib/AppHeader/AppHeader.style.ts +19 -0
- package/dist/lib/AppHeader/AppHeader.tsx +23 -0
- package/dist/lib/AppHeader/index.ts +1 -0
- package/dist/lib/Avatar/Avatar.style.ts +17 -0
- package/dist/lib/Avatar/Avatar.tsx +46 -0
- package/dist/lib/Avatar/index.ts +1 -0
- package/dist/lib/Container/Container.styled.ts +15 -0
- package/dist/lib/Container/Container.tsx +15 -0
- package/dist/lib/Container/index.ts +1 -0
- package/dist/lib/EntryNotFound/EntryNotFound.style.ts +14 -0
- package/dist/lib/EntryNotFound/EntryNotFound.tsx +21 -0
- package/dist/lib/EntryNotFound/calendar.svg +69 -0
- package/dist/lib/EntryNotFound/index.ts +1 -0
- package/dist/lib/Filters/ListSelect/ListSelect.style.ts +38 -0
- package/dist/lib/Filters/ListSelect/ListSelect.tsx +48 -0
- package/dist/lib/Filters/ListSelect/index.ts +1 -0
- package/dist/lib/Filters/Range/Range.style.ts +41 -0
- package/dist/lib/Filters/Range/Range.tsx +48 -0
- package/dist/lib/Filters/Range/index.ts +1 -0
- package/dist/lib/Filters/RowSelect/RowSelect.style.ts +30 -0
- package/dist/lib/Filters/RowSelect/RowSelect.tsx +38 -0
- package/dist/lib/Filters/RowSelect/index.ts +1 -0
- package/dist/lib/Filters/Toggle/Toggle.style.ts +14 -0
- package/dist/lib/Filters/Toggle/Toggle.tsx +26 -0
- package/dist/lib/Filters/Toggle/index.ts +1 -0
- package/dist/lib/HorisontalCalendar/HorizontalCalendar.styled.ts +117 -0
- package/dist/lib/HorisontalCalendar/HorizontalCalendar.tsx +213 -0
- package/dist/lib/HorisontalCalendar/index.ts +1 -0
- package/dist/lib/ImageWithFallback/ImageWithFallback.tsx +37 -0
- package/dist/lib/LetterAvatar/LetterAvatar.styled.ts +32 -0
- package/dist/lib/LetterAvatar/LetterAvatar.tsx +23 -0
- package/dist/lib/Modal/Modal.style.ts +12 -0
- package/dist/lib/Modal/Modal.tsx +30 -0
- package/dist/lib/Modal/index.ts +1 -0
- package/dist/lib/ModalCalendar/ModalCalendar.styled.ts +123 -0
- package/dist/lib/ModalCalendar/ModalCalendar.tsx +71 -0
- package/dist/lib/PersonDateTimeCard/PersonDateTimeCard.styled.ts +36 -0
- package/dist/lib/PersonDateTimeCard/PersonDateTimeCard.tsx +32 -0
- package/dist/lib/Segment/Segment.style.ts +14 -0
- package/dist/lib/Segment/Segment.tsx +29 -0
- package/dist/lib/Segment/index.ts +2 -0
- package/dist/lib/Segment/types.ts +4 -0
- package/dist/lib/SelectImpressionEmoji/ImpressionEmojiEnum.ts +9 -0
- package/dist/lib/SelectImpressionEmoji/SelectImpressionEmoji.styled.ts +28 -0
- package/dist/lib/SelectImpressionEmoji/SelectImpressionEmoji.tsx +56 -0
- package/dist/lib/SelectImpressionEmoji/SelectImpressionEmojiProps.ts +8 -0
- package/dist/lib/SelectImpressionEmoji/emojis.ts +9 -0
- package/dist/lib/SelectImpressionEmoji/index.tsx +14 -0
- package/dist/lib/Theme/global.css +251 -0
- package/dist/lib/Theme/mindly_constants.ts +23 -0
- package/dist/lib/UsersPsychologistScrollList/UserPsychologistScrollList.styled.ts +61 -0
- package/dist/lib/UsersPsychologistScrollList/UsersPsychologistScrollList.tsx +68 -0
- package/dist/lib/archived-consultation-card/ArchivedConsultation.test.tsx +9 -0
- package/dist/lib/archived-consultation-card/ArchivedConsultationCard.style.ts +72 -0
- package/dist/lib/archived-consultation-card/ArchivedConsultationCard.svg +3 -0
- package/dist/lib/archived-consultation-card/ArchivedConsultationCard.tsx +61 -0
- package/dist/lib/button/Button.style.ts +170 -0
- package/dist/lib/button/Button.test.tsx +39 -0
- package/dist/lib/button/Button.tsx +47 -0
- package/dist/lib/consultation-card/ConsultationCard.style.ts +119 -0
- package/dist/lib/consultation-card/ConsultationCard.test.tsx +65 -0
- package/dist/lib/consultation-card/ConsultationCard.tsx +155 -0
- package/dist/lib/consultation-card/ConsultationCardSkeleton.tsx +114 -0
- package/dist/lib/consultation-card/index.ts +2 -0
- package/dist/lib/content-card/ContentCard.style.ts +59 -0
- package/dist/lib/content-card/ContentCard.test.tsx +29 -0
- package/dist/lib/content-card/ContentCard.tsx +81 -0
- package/dist/lib/date-picker/DatePicker.style.ts +52 -0
- package/dist/lib/date-picker/DatePicker.test.tsx +9 -0
- package/dist/lib/date-picker/DatePicker.tsx +59 -0
- package/dist/lib/floating-button/FloatingButton.style.ts +21 -0
- package/dist/lib/floating-button/FloatingButton.test.tsx +9 -0
- package/dist/lib/floating-button/FloatingButton.tsx +29 -0
- package/dist/lib/floating-button/floating button.svg +6 -0
- package/dist/lib/footer-for-booking/FooterForBooking.style.ts +56 -0
- package/dist/lib/footer-for-booking/FooterForBooking.test.tsx +30 -0
- package/dist/lib/footer-for-booking/FooterForBooking.tsx +53 -0
- package/dist/lib/input/Input.style.ts +37 -0
- package/dist/lib/input/Input.test.tsx +21 -0
- package/dist/lib/input/Input.tsx +73 -0
- package/dist/lib/list-button/ListButton.style.ts +21 -0
- package/dist/lib/list-button/ListButton.test.tsx +26 -0
- package/dist/lib/list-button/ListButton.tsx +30 -0
- package/dist/lib/navigation-bar/NavigationBar.style.ts +81 -0
- package/dist/lib/navigation-bar/NavigationBar.test.tsx +15 -0
- package/dist/lib/navigation-bar/NavigationBar.tsx +31 -0
- package/dist/lib/no-internet-connection/NoInternetConnection.style.ts +26 -0
- package/dist/lib/no-internet-connection/NoInternetConnection.svg +10 -0
- package/dist/lib/no-internet-connection/NoInternetConnection.test.tsx +9 -0
- package/dist/lib/no-internet-connection/NoInternetConnection.tsx +30 -0
- package/dist/lib/notes-card-text/NotesCardText.style.ts +14 -0
- package/dist/lib/notes-card-text/NotesCardText.tsx +32 -0
- package/dist/lib/notes-card-text/index.ts +1 -0
- package/dist/lib/notes-editor/NotesEditor.styled.ts +24 -0
- package/dist/lib/notes-editor/NotesEditor.tsx +16 -0
- package/dist/lib/scroll-tabs/ScrollTabs.style.ts +19 -0
- package/dist/lib/scroll-tabs/ScrollTabs.test.tsx +9 -0
- package/dist/lib/scroll-tabs/ScrollTabs.tsx +42 -0
- package/dist/lib/tab-bar/TabBar.style.tsx +43 -0
- package/dist/lib/tab-bar/TabBar.tsx +11 -0
- package/dist/lib/therapist-card/TherapistCard.style.ts +104 -0
- package/dist/lib/therapist-card/TherapistCard.test.tsx +40 -0
- package/dist/lib/therapist-card/TherapistCard.tsx +96 -0
- package/dist/lib/therapist-information-component/TherapistInformationComponent.style.ts +40 -0
- package/dist/lib/therapist-information-component/TherapistInformationComponent.test.tsx +16 -0
- package/dist/lib/therapist-information-component/TherapistInformationComponent.tsx +51 -0
- package/dist/lib/toast/index.css +13 -0
- package/dist/lib/toast/toast.ts +17 -0
- package/dist/lib/userAppTypes.ts +261 -0
- package/dist/lib/your-local-time-block/YourLocalTimeBlock.styled.ts +28 -0
- package/dist/lib/your-local-time-block/YourLocalTimeBlock.tsx +26 -0
- package/dist/react-app-env.d.ts +1 -0
- package/dist/svg.d.ts +13 -0
- package/package.json +4 -17
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { colorConstants } from '../Theme/mindly_constants';
|
|
3
|
+
|
|
4
|
+
interface ContainerProps {
|
|
5
|
+
buttonType:
|
|
6
|
+
| 'primary'
|
|
7
|
+
| 'secondary'
|
|
8
|
+
| 'actionButton'
|
|
9
|
+
| 'actionButtonDisabled'
|
|
10
|
+
| 'secondaryWithStroke'
|
|
11
|
+
| 'secondaryCancel'
|
|
12
|
+
| 'actionButtonActive'
|
|
13
|
+
| 'actionButtonGreen';
|
|
14
|
+
isDisabled: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Container = styled.button<ContainerProps>`
|
|
18
|
+
padding: 12px 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
max-height: 40px;
|
|
22
|
+
border: 0;
|
|
23
|
+
background: ${colorConstants.primaryColor};
|
|
24
|
+
color: ${colorConstants.White};
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
line-height: 16px;
|
|
28
|
+
|
|
29
|
+
&:hover,
|
|
30
|
+
&:active {
|
|
31
|
+
box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.2),
|
|
32
|
+
inset 0 -4px 15px rgba(0, 0, 0, 0.2);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${(props: ContainerProps) =>
|
|
36
|
+
props.buttonType === 'secondary' &&
|
|
37
|
+
css`
|
|
38
|
+
background: inherit;
|
|
39
|
+
color: ${colorConstants.primaryColor};
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
|
|
42
|
+
&:hover,
|
|
43
|
+
&:active {
|
|
44
|
+
box-shadow: none;
|
|
45
|
+
color: ${colorConstants.AccentActiveButtonBG};
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
48
|
+
|
|
49
|
+
${(props: ContainerProps) =>
|
|
50
|
+
props.buttonType === 'secondaryWithStroke' &&
|
|
51
|
+
css`
|
|
52
|
+
color: ${colorConstants.primaryColor};
|
|
53
|
+
background: inherit;
|
|
54
|
+
box-shadow: none;
|
|
55
|
+
border: 1px solid ${colorConstants.primaryColor};
|
|
56
|
+
|
|
57
|
+
&:hover,
|
|
58
|
+
&:active {
|
|
59
|
+
box-shadow: none;
|
|
60
|
+
color: ${colorConstants.AccentActiveButtonBG};
|
|
61
|
+
background: inherit;
|
|
62
|
+
border: 1px solid ${colorConstants.AccentActiveButtonBG};
|
|
63
|
+
}
|
|
64
|
+
`}
|
|
65
|
+
|
|
66
|
+
${(props: ContainerProps) =>
|
|
67
|
+
props.buttonType === 'secondaryCancel' &&
|
|
68
|
+
css`
|
|
69
|
+
color: ${colorConstants.AccentCross};
|
|
70
|
+
background: inherit;
|
|
71
|
+
box-shadow: none;
|
|
72
|
+
border: 0;
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
|
|
75
|
+
&:hover,
|
|
76
|
+
&:active {
|
|
77
|
+
box-shadow: none;
|
|
78
|
+
color: ${colorConstants.AccentCancelActive};
|
|
79
|
+
background: inherit;
|
|
80
|
+
border: 0;
|
|
81
|
+
}
|
|
82
|
+
`}
|
|
83
|
+
|
|
84
|
+
${(props: ContainerProps) =>
|
|
85
|
+
props.buttonType === 'actionButton' &&
|
|
86
|
+
css`
|
|
87
|
+
color: ${colorConstants.AccentDisabledColor};
|
|
88
|
+
background: inherit;
|
|
89
|
+
box-shadow: none;
|
|
90
|
+
border: 1px solid ${colorConstants.AccentDisabledColor};
|
|
91
|
+
|
|
92
|
+
&:hover,
|
|
93
|
+
&:active {
|
|
94
|
+
color: ${colorConstants.AccentDisabledColor};
|
|
95
|
+
background: inherit;
|
|
96
|
+
box-shadow: none;
|
|
97
|
+
border: 1px solid ${colorConstants.AccentDisabledColor};
|
|
98
|
+
}
|
|
99
|
+
`}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
${(props: ContainerProps) =>
|
|
103
|
+
props.isDisabled &&
|
|
104
|
+
css`
|
|
105
|
+
background: ${colorConstants.AccentDisabledColor};
|
|
106
|
+
color: ${colorConstants.White};
|
|
107
|
+
box-shadow: none;
|
|
108
|
+
|
|
109
|
+
&:hover,
|
|
110
|
+
&:active {
|
|
111
|
+
box-shadow: none;
|
|
112
|
+
background: ${colorConstants.AccentDisabledColor};
|
|
113
|
+
color: ${colorConstants.White};
|
|
114
|
+
}
|
|
115
|
+
`}
|
|
116
|
+
|
|
117
|
+
${(props: ContainerProps) =>
|
|
118
|
+
props.buttonType === 'actionButtonDisabled' &&
|
|
119
|
+
css`
|
|
120
|
+
color: ${colorConstants.AccentDisabledColor};
|
|
121
|
+
background: inherit;
|
|
122
|
+
box-shadow: none !important;
|
|
123
|
+
border: 1px solid ${colorConstants.AccentDisabledColor};
|
|
124
|
+
text-decoration: line-through;
|
|
125
|
+
`}
|
|
126
|
+
|
|
127
|
+
${(props: ContainerProps) =>
|
|
128
|
+
props.buttonType === 'actionButtonActive' &&
|
|
129
|
+
css`
|
|
130
|
+
box-shadow: none;
|
|
131
|
+
color: ${colorConstants.primaryColor};
|
|
132
|
+
background: ${colorConstants.AccentSurveyButton};
|
|
133
|
+
border: 1px solid ${colorConstants.primaryColor};
|
|
134
|
+
|
|
135
|
+
&:hover,
|
|
136
|
+
&:active {
|
|
137
|
+
box-shadow: none;
|
|
138
|
+
color: ${colorConstants.primaryColor};
|
|
139
|
+
background: ${colorConstants.AccentSurveyButton};
|
|
140
|
+
border: 1px solid ${colorConstants.primaryColor};
|
|
141
|
+
}
|
|
142
|
+
`}
|
|
143
|
+
|
|
144
|
+
${(props: ContainerProps) =>
|
|
145
|
+
props.buttonType === 'actionButtonGreen' &&
|
|
146
|
+
css`
|
|
147
|
+
color: ${colorConstants.AccentTickColor};
|
|
148
|
+
background: linear-gradient(
|
|
149
|
+
0deg,
|
|
150
|
+
rgba(255, 255, 255, 0.86),
|
|
151
|
+
rgba(255, 255, 255, 0.86)
|
|
152
|
+
),
|
|
153
|
+
${colorConstants.AccentTickColor};
|
|
154
|
+
box-shadow: none;
|
|
155
|
+
border: 1px solid ${colorConstants.AccentTickColor};
|
|
156
|
+
|
|
157
|
+
&:hover,
|
|
158
|
+
&:active {
|
|
159
|
+
box-shadow: none;
|
|
160
|
+
color: ${colorConstants.AccentTickColor};
|
|
161
|
+
background: linear-gradient(
|
|
162
|
+
0deg,
|
|
163
|
+
rgba(255, 255, 255, 0.86),
|
|
164
|
+
rgba(255, 255, 255, 0.86)
|
|
165
|
+
),
|
|
166
|
+
${colorConstants.AccentTickColor};
|
|
167
|
+
border: 1px solid ${colorConstants.AccentTickColor};
|
|
168
|
+
}
|
|
169
|
+
`}
|
|
170
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
|
|
5
|
+
describe('Test button', () => {
|
|
6
|
+
test('Smoke test button', () => {
|
|
7
|
+
render(
|
|
8
|
+
<Button buttonType="primary" isDisabled onClick={() => undefined}>
|
|
9
|
+
Text
|
|
10
|
+
</Button>
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Click on button test', () => {
|
|
15
|
+
const clickFuncMock = jest.fn();
|
|
16
|
+
const { getByText } = render(
|
|
17
|
+
<Button onClick={clickFuncMock} buttonType="primary" isDisabled={false}>
|
|
18
|
+
Text
|
|
19
|
+
</Button>
|
|
20
|
+
);
|
|
21
|
+
const button = getByText('Text');
|
|
22
|
+
expect(clickFuncMock).not.toHaveBeenCalled();
|
|
23
|
+
button.click();
|
|
24
|
+
expect(clickFuncMock).toHaveBeenCalled();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('Text is button disabled', () => {
|
|
28
|
+
const clickFuncMock = jest.fn();
|
|
29
|
+
const { getByText } = render(
|
|
30
|
+
<Button onClick={clickFuncMock} buttonType="primary" isDisabled>
|
|
31
|
+
Text
|
|
32
|
+
</Button>
|
|
33
|
+
);
|
|
34
|
+
const button = getByText('Text');
|
|
35
|
+
expect(clickFuncMock).not.toHaveBeenCalled();
|
|
36
|
+
button.click();
|
|
37
|
+
expect(clickFuncMock).not.toHaveBeenCalled();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Container } from './Button.style';
|
|
3
|
+
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
/*
|
|
6
|
+
* A props that sets the appearance of the button
|
|
7
|
+
*/
|
|
8
|
+
buttonType:
|
|
9
|
+
| 'primary'
|
|
10
|
+
| 'secondary'
|
|
11
|
+
| 'actionButton'
|
|
12
|
+
| 'actionButtonDisabled'
|
|
13
|
+
| 'secondaryWithStroke'
|
|
14
|
+
| 'secondaryCancel'
|
|
15
|
+
| 'actionButtonActive'
|
|
16
|
+
| 'actionButtonGreen';
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Toggles clickability of button. Also changes appearance
|
|
20
|
+
*/
|
|
21
|
+
isDisabled: boolean;
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Text inside the button (default React children)
|
|
25
|
+
*/
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Default React onClick
|
|
30
|
+
*/
|
|
31
|
+
onClick?: (props?: React.SyntheticEvent) => void;
|
|
32
|
+
['data-testid']?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Button: React.FC<ButtonProps> = (props) => {
|
|
36
|
+
return (
|
|
37
|
+
<Container
|
|
38
|
+
data-testid={props['data-testid']}
|
|
39
|
+
onClick={props?.onClick}
|
|
40
|
+
disabled={props.isDisabled}
|
|
41
|
+
isDisabled={props.isDisabled}
|
|
42
|
+
buttonType={props.buttonType}
|
|
43
|
+
>
|
|
44
|
+
{props.children}
|
|
45
|
+
</Container>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { colorConstants } from '../Theme/mindly_constants';
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 16px;
|
|
7
|
+
border: 1px solid ${colorConstants.StrokeGray};
|
|
8
|
+
box-shadow: 1px 5px 20px rgba(0, 0, 0, 0.1);
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export const InfoContainer = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
height: 104px;
|
|
17
|
+
|
|
18
|
+
& .person-avatar {
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
font-size: 41px;
|
|
22
|
+
line-height: 61px;
|
|
23
|
+
flex: 0 0 104px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const TextInfo = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
margin-right: 8px;
|
|
31
|
+
justify-content: space-around;
|
|
32
|
+
height: 100%;
|
|
33
|
+
|
|
34
|
+
h3 {
|
|
35
|
+
color: #5b5b5b;
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
line-height: 16px;
|
|
39
|
+
font-family: 'Inter', sans-serif;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
span {
|
|
43
|
+
color: ${colorConstants.primaryColor};
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
line-height: 16px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
h2.time {
|
|
50
|
+
font-family: 'Inter';
|
|
51
|
+
font-style: normal;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
line-height: 16px;
|
|
55
|
+
color: #1d201f;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
div.is-free {
|
|
59
|
+
margin-top: 12px;
|
|
60
|
+
padding: 2px 7px;
|
|
61
|
+
border-radius: 12px;
|
|
62
|
+
max-width: max-content;
|
|
63
|
+
text-align: center;
|
|
64
|
+
|
|
65
|
+
&.greeny {
|
|
66
|
+
background-color: #cfe2d7;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.reddy {
|
|
70
|
+
background-color: #ffc7c7;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
h2 {
|
|
74
|
+
font-weight: 700;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
line-height: 16px;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
export const Photo = styled.img`
|
|
82
|
+
width: 104px;
|
|
83
|
+
height: 104px;
|
|
84
|
+
border-radius: 8px;
|
|
85
|
+
object-fit: cover;
|
|
86
|
+
flex: 0 0 104px;
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
export const DividersContainer = styled.div`
|
|
90
|
+
margin: 16px 0 4px 0;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
|
|
95
|
+
div.divider {
|
|
96
|
+
height: 1px;
|
|
97
|
+
flex-grow: 1;
|
|
98
|
+
background: ${colorConstants.AccentDisabledColor};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
h4 {
|
|
102
|
+
color: #c1c1c1;
|
|
103
|
+
margin: 0 16px;
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
line-height: 14px;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
export const ButtonContainer = styled.div`
|
|
110
|
+
display: flex;
|
|
111
|
+
|
|
112
|
+
& button {
|
|
113
|
+
padding: 0;
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
export const ButtonsContainer = styled.div`
|
|
118
|
+
margin-top: 16px;
|
|
119
|
+
`;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { ConsultationCard, DateTimeType } from './ConsultationCard';
|
|
4
|
+
import { DateTime } from 'luxon';
|
|
5
|
+
|
|
6
|
+
describe('Test consultation card', () => {
|
|
7
|
+
test('Smoke test', () => {
|
|
8
|
+
render(
|
|
9
|
+
<ConsultationCard
|
|
10
|
+
startConsultation={() => undefined}
|
|
11
|
+
handleReschedule={() => undefined}
|
|
12
|
+
handleRefund={() => undefined}
|
|
13
|
+
consultationWith="Елена Шимановская"
|
|
14
|
+
avatar=""
|
|
15
|
+
autorecord
|
|
16
|
+
userTimeZone="America/New_York"
|
|
17
|
+
consultationTime={
|
|
18
|
+
{
|
|
19
|
+
_seconds: DateTime.now().toSeconds(),
|
|
20
|
+
_nanoseconds: 0,
|
|
21
|
+
} as DateTimeType
|
|
22
|
+
}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('Text all handle clicks', () => {
|
|
28
|
+
const startConsultation = jest.fn();
|
|
29
|
+
const handleRefund = jest.fn();
|
|
30
|
+
|
|
31
|
+
render(
|
|
32
|
+
<ConsultationCard
|
|
33
|
+
startConsultation={() => startConsultation()}
|
|
34
|
+
handleReschedule={() => undefined}
|
|
35
|
+
handleRefund={() => handleRefund()}
|
|
36
|
+
consultationWith="Елена Шимановская"
|
|
37
|
+
avatar=""
|
|
38
|
+
autorecord
|
|
39
|
+
userTimeZone="America/New_York"
|
|
40
|
+
consultationTime={
|
|
41
|
+
{
|
|
42
|
+
_seconds: DateTime.now().toSeconds(),
|
|
43
|
+
_nanoseconds: 0,
|
|
44
|
+
} as DateTimeType
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const refundButton = screen.getByText('Відмінити');
|
|
50
|
+
const startConsultationButton = screen.getByText('Почати консультацію');
|
|
51
|
+
expect(startConsultation).toHaveBeenCalledTimes(0);
|
|
52
|
+
expect(handleRefund).toHaveBeenCalledTimes(0);
|
|
53
|
+
|
|
54
|
+
startConsultationButton.click();
|
|
55
|
+
expect(startConsultation).toHaveBeenCalledTimes(1);
|
|
56
|
+
expect(handleRefund).toHaveBeenCalledTimes(0);
|
|
57
|
+
|
|
58
|
+
expect(startConsultation).toHaveBeenCalledTimes(1);
|
|
59
|
+
expect(handleRefund).toHaveBeenCalledTimes(0);
|
|
60
|
+
|
|
61
|
+
refundButton.click();
|
|
62
|
+
expect(startConsultation).toHaveBeenCalledTimes(1);
|
|
63
|
+
expect(handleRefund).toHaveBeenCalledTimes(1);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ButtonContainer,
|
|
4
|
+
ButtonsContainer,
|
|
5
|
+
Container,
|
|
6
|
+
DividersContainer,
|
|
7
|
+
InfoContainer,
|
|
8
|
+
TextInfo,
|
|
9
|
+
} from './ConsultationCard.style';
|
|
10
|
+
import { Button } from '../button/Button';
|
|
11
|
+
import '../Theme/global.css';
|
|
12
|
+
import { DateTime } from 'luxon';
|
|
13
|
+
import { Avatar } from '../Avatar';
|
|
14
|
+
|
|
15
|
+
export enum DayOfWeeks {
|
|
16
|
+
'Понеділок' = 1,
|
|
17
|
+
'Вівторок',
|
|
18
|
+
'Середа',
|
|
19
|
+
'Четверг',
|
|
20
|
+
"П'ятниця",
|
|
21
|
+
'Субота',
|
|
22
|
+
'Неділя',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type DateTimeType = {
|
|
26
|
+
_nanoseconds: number;
|
|
27
|
+
_seconds: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface ConsultationCardProps {
|
|
31
|
+
/*
|
|
32
|
+
* Here you need to pass a function to start consultation
|
|
33
|
+
*/
|
|
34
|
+
startConsultation: (props?: React.SyntheticEvent) => void;
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Function for refund consultation
|
|
38
|
+
*/
|
|
39
|
+
handleReschedule: (props?: React.SyntheticEvent) => void;
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Function for refund consultation
|
|
43
|
+
*/
|
|
44
|
+
handleRefund: (props?: React.SyntheticEvent) => void;
|
|
45
|
+
handleNotes?: (props?: React.SyntheticEvent) => void;
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
* Psychologist name and last name
|
|
49
|
+
*/
|
|
50
|
+
consultationWith: string;
|
|
51
|
+
|
|
52
|
+
consultationTime: DateTimeType;
|
|
53
|
+
userTimeZone: string;
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* Psychologist avatar link
|
|
57
|
+
*/
|
|
58
|
+
avatar: string;
|
|
59
|
+
autorecord?: boolean;
|
|
60
|
+
|
|
61
|
+
['data-container-testid']?: string;
|
|
62
|
+
['data-start-testid']?: string;
|
|
63
|
+
['data-reschedule-testid']?: string;
|
|
64
|
+
['data-refund-testid']?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const ConsultationCard: React.FC<ConsultationCardProps> = ({
|
|
68
|
+
startConsultation,
|
|
69
|
+
handleReschedule,
|
|
70
|
+
handleRefund,
|
|
71
|
+
consultationWith,
|
|
72
|
+
consultationTime,
|
|
73
|
+
userTimeZone,
|
|
74
|
+
avatar,
|
|
75
|
+
autorecord = false,
|
|
76
|
+
...props
|
|
77
|
+
}) => {
|
|
78
|
+
const time = DateTime.fromSeconds(consultationTime._seconds)
|
|
79
|
+
.setZone(userTimeZone)
|
|
80
|
+
.setLocale('uk-UK');
|
|
81
|
+
const finishedTime = DateTime.fromSeconds(consultationTime._seconds)
|
|
82
|
+
.setZone(userTimeZone)
|
|
83
|
+
.setLocale('uk-UK')
|
|
84
|
+
.plus({ minute: 50 });
|
|
85
|
+
const currentTime = DateTime.now().setZone(userTimeZone).setLocale('uk-UK');
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Container data-testid={props['data-container-testid']}>
|
|
89
|
+
<InfoContainer>
|
|
90
|
+
<TextInfo>
|
|
91
|
+
<h3>Консультація з {consultationWith}</h3>
|
|
92
|
+
{autorecord && <span>Автозапис</span>}
|
|
93
|
+
<h2 className="time">
|
|
94
|
+
{currentTime.toSeconds() <= finishedTime.toSeconds() ? (
|
|
95
|
+
<>
|
|
96
|
+
{DayOfWeeks[time.weekday]}
|
|
97
|
+
<br />
|
|
98
|
+
</>
|
|
99
|
+
) : (
|
|
100
|
+
<>
|
|
101
|
+
Відбулась <br />
|
|
102
|
+
</>
|
|
103
|
+
)}
|
|
104
|
+
{time.toLocaleString({
|
|
105
|
+
month: 'long',
|
|
106
|
+
day: 'numeric',
|
|
107
|
+
})}{' '}
|
|
108
|
+
о {time.toFormat('HH:mm')}
|
|
109
|
+
</h2>
|
|
110
|
+
</TextInfo>
|
|
111
|
+
<Avatar
|
|
112
|
+
src={avatar}
|
|
113
|
+
dimensions={104}
|
|
114
|
+
firstName={consultationWith}
|
|
115
|
+
className="person-avatar"
|
|
116
|
+
/>
|
|
117
|
+
</InfoContainer>
|
|
118
|
+
{currentTime.toSeconds() <= finishedTime.toSeconds() && (
|
|
119
|
+
<ButtonsContainer>
|
|
120
|
+
<Button
|
|
121
|
+
buttonType="primary"
|
|
122
|
+
isDisabled={false}
|
|
123
|
+
data-testid={props['data-start-testid']}
|
|
124
|
+
onClick={startConsultation} // # skipcq JS-0411
|
|
125
|
+
>
|
|
126
|
+
Почати консультацію
|
|
127
|
+
</Button>
|
|
128
|
+
<DividersContainer>
|
|
129
|
+
<div className="divider" />
|
|
130
|
+
<h4>чи</h4>
|
|
131
|
+
<div className="divider" />
|
|
132
|
+
</DividersContainer>
|
|
133
|
+
<ButtonContainer>
|
|
134
|
+
<Button
|
|
135
|
+
buttonType="secondaryCancel"
|
|
136
|
+
isDisabled={false}
|
|
137
|
+
onClick={handleRefund}
|
|
138
|
+
data-testid={props['data-refund-testid']}
|
|
139
|
+
>
|
|
140
|
+
Відмінити
|
|
141
|
+
</Button>
|
|
142
|
+
<Button
|
|
143
|
+
buttonType="secondary"
|
|
144
|
+
isDisabled={false}
|
|
145
|
+
onClick={handleReschedule}
|
|
146
|
+
data-testid={props['data-refund-testid']}
|
|
147
|
+
>
|
|
148
|
+
Перенести
|
|
149
|
+
</Button>
|
|
150
|
+
</ButtonContainer>
|
|
151
|
+
</ButtonsContainer>
|
|
152
|
+
)}
|
|
153
|
+
</Container>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IonSkeletonText } from '@ionic/react';
|
|
3
|
+
import {
|
|
4
|
+
ButtonContainer,
|
|
5
|
+
Container,
|
|
6
|
+
InfoContainer,
|
|
7
|
+
TextInfo,
|
|
8
|
+
} from './ConsultationCard.style';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
11
|
+
export const ConsultationCardSkeleton = () => {
|
|
12
|
+
return (
|
|
13
|
+
<Container>
|
|
14
|
+
<InfoContainer style={{ marginBottom: '16px' }}>
|
|
15
|
+
<TextInfo style={{ padding: '6px 0' }}>
|
|
16
|
+
<IonSkeletonText
|
|
17
|
+
animated
|
|
18
|
+
style={{
|
|
19
|
+
width: '159px',
|
|
20
|
+
height: '10px',
|
|
21
|
+
borderRadius: '4px',
|
|
22
|
+
margin: '0',
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
<IonSkeletonText
|
|
26
|
+
animated
|
|
27
|
+
style={{
|
|
28
|
+
width: '69px',
|
|
29
|
+
height: '10px',
|
|
30
|
+
borderRadius: '4px',
|
|
31
|
+
margin: '0',
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
<IonSkeletonText
|
|
35
|
+
animated
|
|
36
|
+
style={{
|
|
37
|
+
width: '74px',
|
|
38
|
+
height: '14px',
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
margin: '0',
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
<IonSkeletonText
|
|
44
|
+
animated
|
|
45
|
+
style={{
|
|
46
|
+
width: '57px',
|
|
47
|
+
height: '11px',
|
|
48
|
+
borderRadius: '4px',
|
|
49
|
+
margin: '0',
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<IonSkeletonText
|
|
53
|
+
animated
|
|
54
|
+
style={{
|
|
55
|
+
width: '118px',
|
|
56
|
+
height: '11px',
|
|
57
|
+
borderRadius: '4px',
|
|
58
|
+
margin: '0',
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
</TextInfo>
|
|
62
|
+
<IonSkeletonText
|
|
63
|
+
animated
|
|
64
|
+
style={{
|
|
65
|
+
width: '104px',
|
|
66
|
+
height: '104px',
|
|
67
|
+
borderRadius: '8px',
|
|
68
|
+
margin: '0',
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
</InfoContainer>
|
|
72
|
+
<IonSkeletonText
|
|
73
|
+
animated
|
|
74
|
+
style={{
|
|
75
|
+
width: '100%',
|
|
76
|
+
height: '40px',
|
|
77
|
+
borderRadius: '4px',
|
|
78
|
+
margin: '0 0 20px 0',
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
<IonSkeletonText
|
|
82
|
+
animated
|
|
83
|
+
style={{
|
|
84
|
+
width: '100%',
|
|
85
|
+
height: '7px',
|
|
86
|
+
borderRadius: '4px',
|
|
87
|
+
margin: '0 0 17px 0',
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<ButtonContainer
|
|
91
|
+
style={{ justifyContent: 'space-around', paddingBottom: '13px' }}
|
|
92
|
+
>
|
|
93
|
+
<IonSkeletonText
|
|
94
|
+
animated
|
|
95
|
+
style={{
|
|
96
|
+
width: '68px',
|
|
97
|
+
height: '14px',
|
|
98
|
+
borderRadius: '4px',
|
|
99
|
+
margin: '0',
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
<IonSkeletonText
|
|
103
|
+
animated
|
|
104
|
+
style={{
|
|
105
|
+
width: '76px',
|
|
106
|
+
height: '14px',
|
|
107
|
+
borderRadius: '4px',
|
|
108
|
+
margin: '0',
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
</ButtonContainer>
|
|
112
|
+
</Container>
|
|
113
|
+
);
|
|
114
|
+
};
|