@tactics/toddle-styleguide 1.2.8 → 1.3.0
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 +11 -0
- package/index.d.ts +2 -1
- package/index.tsx +2 -0
- package/package.json +1 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +18 -18
- package/src/components/atoms/line/line.component.d.ts +12 -0
- package/src/components/atoms/line/line.component.tsx +23 -0
- package/src/components/atoms/line/line.preview.d.ts +1 -0
- package/src/components/atoms/line/line.preview.tsx +54 -0
- package/src/components/atoms/line/line.styles.d.ts +12 -0
- package/src/components/atoms/line/line.styles.js +10 -0
- package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +72 -1
- package/src/components/atoms/quick-message/quick-message.component.d.ts +2 -0
- package/src/components/atoms/quick-message/quick-message.component.tsx +3 -1
- package/src/components/atoms/quick-message/quick-message.preview.tsx +10 -1
- package/src/components/atoms/quick-message/quick-message.styles.d.ts +4 -1
- package/src/components/atoms/quick-message/quick-message.styles.js +4 -2
- package/src/components/atoms/quick-message/quick-message.test.js +38 -6
- package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +38 -78
- package/src/components/atoms/text-input/text-input.component.tsx +6 -9
- package/src/components/atoms/text-input/text-input.preview.tsx +3 -3
- package/src/components/atoms/text-input/text-input.styles.d.ts +9 -25
- package/src/components/atoms/text-input/text-input.styles.js +7 -13
- package/src/components/molecules/day/__snapshots__/day.test.js.snap +24 -24
- package/src/components/molecules/day/day.component.tsx +17 -4
- package/src/components/molecules/day/day.styles.d.ts +33 -42
- package/src/components/molecules/day/day.styles.js +14 -17
- package/src/components/molecules/failed-to-send/failed-bubble.component.d.ts +2 -2
- package/src/components/molecules/failed-to-send/failed-bubble.component.tsx +39 -22
- package/src/components/molecules/password-input/__snapshots__/password-input.test.js.snap +53 -68
- package/src/components/molecules/password-input/password-input.component.tsx +7 -9
- package/src/components/molecules/password-input/password-input.styles.d.ts +8 -7
- package/src/components/molecules/password-input/password-input.styles.js +6 -6
- package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +30 -31
- package/src/components/molecules/search-input/search.component.d.ts +9 -11
- package/src/components/molecules/search-input/search.component.tsx +19 -30
- package/src/components/molecules/search-input/search.preview.tsx +8 -6
- package/src/components/molecules/search-input/search.styles.d.ts +12 -11
- package/src/components/molecules/search-input/search.styles.js +14 -8
- package/src/components/molecules/search-input/search.test.js +3 -1
- package/src/components/molecules/send-bubble/__snapshots__/send-text-bubble.test.js.snap +12 -32
- package/src/components/molecules/send-bubble/send-text-bubble.component.d.ts +4 -4
- package/src/components/molecules/send-bubble/send-text-bubble.component.tsx +36 -25
- package/src/components/molecules/send-bubble/send-text-bubble.styles.d.ts +4 -7
- package/src/components/molecules/send-bubble/send-text-bubble.styles.js +2 -8
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +4 -4
- package/src/components/molecules/timeline/timeline.styles.d.ts +1 -1
- package/src/components/molecules/timeline/timeline.styles.js +2 -2
- package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +2 -1
- package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -1
- package/src/components/molecules/timestamp/timestamp.component.tsx +4 -7
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +165 -10
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -0
- package/src/components/organisms/child-list-item/child-list-item.component.tsx +24 -1
- package/src/components/organisms/child-list-item/child-list-item.preview.tsx +11 -0
- package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +0 -3
- package/src/components/organisms/child-list-item/child-list-item.styles.js +2 -3
- package/src/components/organisms/child-list-item/child-list-item.test.js +9 -4
- package/src/components/organisms/child-list-item/components/child-list-tag.component.d.ts +9 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.component.tsx +28 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.d.ts +13 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.js +16 -0
- package/src/components/organisms/day-select/day-select.preview.tsx +9 -5
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.d.ts +9 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.js +17 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.test.js +21 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.tsx +97 -0
- package/src/components/organisms/journal-entry/components/index.d.ts +2 -0
- package/src/components/organisms/journal-entry/components/index.ts +2 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/__snapshots__/journal-entry-type.test.js.snap +304 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +60 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.js +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.test.js +48 -0
- package/src/components/organisms/journal-entry/journal-entry.component.d.ts +38 -0
- package/src/components/organisms/journal-entry/journal-entry.component.tsx +139 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.d.ts +1 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.tsx +212 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.d.ts +42 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.js +35 -0
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +143 -399
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +5 -7
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.tsx +32 -59
- package/src/components/organisms/my-child-list-item/my-child-list-item.preview.tsx +36 -24
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +15 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.js +16 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +5 -22
- package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +45 -29
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +8 -6
- package/src/components/organisms/text-bubble/text-bubble.component.tsx +14 -12
- package/src/components/organisms/text-bubble/text-bubble.preview.tsx +14 -19
- package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +14 -3
- package/src/components/organisms/text-bubble/text-bubble.styles.js +6 -0
- package/src/components/organisms/text-bubble/text-bubble.test.js +7 -7
- package/src/components/templates/modal/components/fade-panel.component.tsx +1 -1
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +4 -0
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +6 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +14 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +31 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +114 -84
- package/src/utilities/toddle-datetime/types/{duration-like.type.d.ts → duration.type.d.ts} +2 -0
- package/src/utilities/toddle-datetime/types/{duration-like.type.tsx → duration.type.tsx} +3 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +1 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +8 -1
package/App.tsx
CHANGED
|
@@ -71,6 +71,8 @@ import {TimePickerPreview} from './src/components/molecules/time-picker/time-pic
|
|
|
71
71
|
import {PopOverActionPreview} from './src/components/templates/popover-action/popover-action.preview';
|
|
72
72
|
import {QuickMessagePreview} from './src/components/atoms/quick-message/quick-message.preview';
|
|
73
73
|
import {TabViewPreview} from './src/components/organisms/tab-view/tab-view.preview';
|
|
74
|
+
import {LinePreview} from './src/components/atoms/line/line.preview';
|
|
75
|
+
import {JournalEntryPreview} from './src/components/organisms/journal-entry/journal-entry.preview';
|
|
74
76
|
|
|
75
77
|
const Stack = createNativeStackNavigator();
|
|
76
78
|
|
|
@@ -179,10 +181,15 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
|
|
|
179
181
|
title="Info Component"
|
|
180
182
|
onPress={() => navigation.push('info')}
|
|
181
183
|
/>
|
|
184
|
+
<ReactBtn
|
|
185
|
+
title="Journal Entry"
|
|
186
|
+
onPress={() => navigation.push('journal-entry')}
|
|
187
|
+
/>
|
|
182
188
|
<ReactBtn
|
|
183
189
|
title="Language Button"
|
|
184
190
|
onPress={() => navigation.push('language-button')}
|
|
185
191
|
/>
|
|
192
|
+
<ReactBtn title="Line" onPress={() => navigation.push('line')} />
|
|
186
193
|
<ReactBtn
|
|
187
194
|
title="Loading Indicator"
|
|
188
195
|
onPress={() => navigation.push('loading-indicator')}
|
|
@@ -371,9 +378,13 @@ function App() {
|
|
|
371
378
|
{() => <IncrementInputPreview />}
|
|
372
379
|
</Stack.Screen>
|
|
373
380
|
<Stack.Screen name="info">{() => <InfoPreview />}</Stack.Screen>
|
|
381
|
+
<Stack.Screen name="journal-entry">
|
|
382
|
+
{() => <JournalEntryPreview />}
|
|
383
|
+
</Stack.Screen>
|
|
374
384
|
<Stack.Screen name="language-button">
|
|
375
385
|
{() => <LanguageButtonPreview />}
|
|
376
386
|
</Stack.Screen>
|
|
387
|
+
<Stack.Screen name="line">{() => <LinePreview />}</Stack.Screen>
|
|
377
388
|
<Stack.Screen name="loading-indicator">
|
|
378
389
|
{() => <LoadingIndicatorPreview />}
|
|
379
390
|
</Stack.Screen>
|
package/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ import { TimePicker } from './src/components/molecules/time-picker/time-picker.c
|
|
|
56
56
|
import { PopOverAction } from './src/components/templates/popover-action/popover-action.component';
|
|
57
57
|
import { QuickMessage } from './src/components/atoms/quick-message/quick-message.component';
|
|
58
58
|
import { TabView } from './src/components/organisms/tab-view/tab-view.component';
|
|
59
|
+
import { Line } from './src/components/atoms/line/line.component';
|
|
59
60
|
import { BubbleAlignment } from './src/types/bubble-alignment.enum';
|
|
60
61
|
import { KeyBoardTypes } from './src/types/keyboard-types.enum';
|
|
61
62
|
import { Size } from './src/types/size.enum';
|
|
@@ -65,4 +66,4 @@ import { ToddleDateTime } from './src/utilities/toddle-datetime/toddle-datetime.
|
|
|
65
66
|
import { ThemeCtx } from './src/context/theme.context';
|
|
66
67
|
import { Scale } from './src/theme/scale/index';
|
|
67
68
|
import CreateResponsiveStyle from './src/theme/responsive/index';
|
|
68
|
-
export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, LanguageButton, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, };
|
|
69
|
+
export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, LanguageButton, Line, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, };
|
package/index.tsx
CHANGED
|
@@ -74,6 +74,7 @@ import {TimePicker} from './src/components/molecules/time-picker/time-picker.com
|
|
|
74
74
|
import {PopOverAction} from './src/components/templates/popover-action/popover-action.component';
|
|
75
75
|
import {QuickMessage} from './src/components/atoms/quick-message/quick-message.component';
|
|
76
76
|
import {TabView} from './src/components/organisms/tab-view/tab-view.component';
|
|
77
|
+
import {Line} from './src/components/atoms/line/line.component';
|
|
77
78
|
|
|
78
79
|
// Exports of enums
|
|
79
80
|
import {BubbleAlignment} from './src/types/bubble-alignment.enum';
|
|
@@ -126,6 +127,7 @@ export {
|
|
|
126
127
|
IncrementInput,
|
|
127
128
|
Info,
|
|
128
129
|
LanguageButton,
|
|
130
|
+
Line,
|
|
129
131
|
LoadingIndicator,
|
|
130
132
|
Logo,
|
|
131
133
|
MessageInput,
|
package/package.json
CHANGED
|
@@ -642,7 +642,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
642
642
|
}
|
|
643
643
|
>
|
|
644
644
|
<View
|
|
645
|
-
accessibilityLabel="
|
|
645
|
+
accessibilityLabel=" Woensdag 2 Augustus 2023 "
|
|
646
646
|
accessibilityRole="button"
|
|
647
647
|
accessibilityState={
|
|
648
648
|
{
|
|
@@ -674,10 +674,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
674
674
|
style={
|
|
675
675
|
{
|
|
676
676
|
"alignItems": "center",
|
|
677
|
-
"borderColor": "#7B93DB",
|
|
678
|
-
"borderRadius": 21,
|
|
679
|
-
"borderStyle": "solid",
|
|
680
|
-
"borderWidth": 1,
|
|
681
677
|
"height": 42,
|
|
682
678
|
"justifyContent": "center",
|
|
683
679
|
"opacity": 1,
|
|
@@ -697,9 +693,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
697
693
|
"lineHeight": 22.4,
|
|
698
694
|
"marginTop": 4,
|
|
699
695
|
},
|
|
700
|
-
{
|
|
701
|
-
"color": "#7B93DB",
|
|
702
|
-
},
|
|
703
696
|
]
|
|
704
697
|
}
|
|
705
698
|
>
|
|
@@ -1307,7 +1300,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1307
1300
|
}
|
|
1308
1301
|
>
|
|
1309
1302
|
<View
|
|
1310
|
-
accessibilityLabel=" Donderdag 10 Augustus 2023 "
|
|
1303
|
+
accessibilityLabel="today Donderdag 10 Augustus 2023 "
|
|
1311
1304
|
accessibilityRole="button"
|
|
1312
1305
|
accessibilityState={
|
|
1313
1306
|
{
|
|
@@ -1339,6 +1332,10 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1339
1332
|
style={
|
|
1340
1333
|
{
|
|
1341
1334
|
"alignItems": "center",
|
|
1335
|
+
"borderColor": "#7B93DB",
|
|
1336
|
+
"borderRadius": 21,
|
|
1337
|
+
"borderStyle": "solid",
|
|
1338
|
+
"borderWidth": 1,
|
|
1342
1339
|
"height": 42,
|
|
1343
1340
|
"justifyContent": "center",
|
|
1344
1341
|
"opacity": 1,
|
|
@@ -1358,6 +1355,9 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
1358
1355
|
"lineHeight": 22.4,
|
|
1359
1356
|
"marginTop": 4,
|
|
1360
1357
|
},
|
|
1358
|
+
{
|
|
1359
|
+
"color": "#7B93DB",
|
|
1360
|
+
},
|
|
1361
1361
|
]
|
|
1362
1362
|
}
|
|
1363
1363
|
>
|
|
@@ -4009,8 +4009,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4009
4009
|
}
|
|
4010
4010
|
>
|
|
4011
4011
|
<View
|
|
4012
|
-
accessibilityLabel="
|
|
4013
|
-
accessibilityRole="button"
|
|
4012
|
+
accessibilityLabel=" Woensdag 2 Augustus 2023 "
|
|
4014
4013
|
accessibilityState={
|
|
4015
4014
|
{
|
|
4016
4015
|
"busy": undefined,
|
|
@@ -4041,10 +4040,6 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4041
4040
|
style={
|
|
4042
4041
|
{
|
|
4043
4042
|
"alignItems": "center",
|
|
4044
|
-
"borderColor": "#7B93DB",
|
|
4045
|
-
"borderRadius": 21,
|
|
4046
|
-
"borderStyle": "solid",
|
|
4047
|
-
"borderWidth": 1,
|
|
4048
4043
|
"height": 42,
|
|
4049
4044
|
"justifyContent": "center",
|
|
4050
4045
|
"opacity": 1,
|
|
@@ -4065,7 +4060,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4065
4060
|
"marginTop": 4,
|
|
4066
4061
|
},
|
|
4067
4062
|
{
|
|
4068
|
-
"color": "#
|
|
4063
|
+
"color": "#9AA5B1",
|
|
4069
4064
|
},
|
|
4070
4065
|
]
|
|
4071
4066
|
}
|
|
@@ -4688,7 +4683,8 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4688
4683
|
}
|
|
4689
4684
|
>
|
|
4690
4685
|
<View
|
|
4691
|
-
accessibilityLabel=" Donderdag 10 Augustus 2023 "
|
|
4686
|
+
accessibilityLabel="today Donderdag 10 Augustus 2023 "
|
|
4687
|
+
accessibilityRole="button"
|
|
4692
4688
|
accessibilityState={
|
|
4693
4689
|
{
|
|
4694
4690
|
"busy": undefined,
|
|
@@ -4719,6 +4715,10 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4719
4715
|
style={
|
|
4720
4716
|
{
|
|
4721
4717
|
"alignItems": "center",
|
|
4718
|
+
"borderColor": "#7B93DB",
|
|
4719
|
+
"borderRadius": 21,
|
|
4720
|
+
"borderStyle": "solid",
|
|
4721
|
+
"borderWidth": 1,
|
|
4722
4722
|
"height": 42,
|
|
4723
4723
|
"justifyContent": "center",
|
|
4724
4724
|
"opacity": 1,
|
|
@@ -4739,7 +4739,7 @@ exports[`Test for the calendar component renders a calendar where you can select
|
|
|
4739
4739
|
"marginTop": 4,
|
|
4740
4740
|
},
|
|
4741
4741
|
{
|
|
4742
|
-
"color": "#
|
|
4742
|
+
"color": "#7B93DB",
|
|
4743
4743
|
},
|
|
4744
4744
|
]
|
|
4745
4745
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
2
|
+
interface LineProps {
|
|
3
|
+
color?: string;
|
|
4
|
+
thickness?: number;
|
|
5
|
+
orientation?: Orientation;
|
|
6
|
+
}
|
|
7
|
+
export declare const Line: ({
|
|
8
|
+
color,
|
|
9
|
+
thickness,
|
|
10
|
+
orientation,
|
|
11
|
+
}: LineProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {useContext} from 'react';
|
|
4
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
+
import {Stylesheet} from './line.styles';
|
|
6
|
+
|
|
7
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
8
|
+
|
|
9
|
+
interface LineProps {
|
|
10
|
+
color?: string;
|
|
11
|
+
thickness?: number;
|
|
12
|
+
orientation?: Orientation;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Line = ({
|
|
16
|
+
color,
|
|
17
|
+
thickness = 1,
|
|
18
|
+
orientation = 'horizontal',
|
|
19
|
+
}: LineProps) => {
|
|
20
|
+
const context = useContext(ThemeCtx);
|
|
21
|
+
const styles = Stylesheet(context, color, orientation, thickness);
|
|
22
|
+
return <View style={styles.container} />;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LinePreview: () => JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {View} from 'react-native';
|
|
2
|
+
import {Line} from './line.component';
|
|
3
|
+
import {useContext} from 'react';
|
|
4
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
+
|
|
6
|
+
export const LinePreview = () => {
|
|
7
|
+
const context = useContext(ThemeCtx);
|
|
8
|
+
return (
|
|
9
|
+
<View style={{flex: 1, gap: 24, padding: 32, backgroundColor: 'white'}}>
|
|
10
|
+
<Line />
|
|
11
|
+
<Line
|
|
12
|
+
color={context.colors.main[5]}
|
|
13
|
+
orientation={'horizontal'}
|
|
14
|
+
thickness={2}
|
|
15
|
+
/>
|
|
16
|
+
<Line
|
|
17
|
+
color={context.colors.main[9]}
|
|
18
|
+
orientation={'horizontal'}
|
|
19
|
+
thickness={3}
|
|
20
|
+
/>
|
|
21
|
+
<View
|
|
22
|
+
style={{
|
|
23
|
+
flex: 1,
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
justifyContent: 'space-around',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<Line
|
|
30
|
+
color={context.colors.main[7]}
|
|
31
|
+
orientation={'vertical'}
|
|
32
|
+
thickness={14}
|
|
33
|
+
/>
|
|
34
|
+
<Line
|
|
35
|
+
color={context.colors.main[0]}
|
|
36
|
+
orientation={'vertical'}
|
|
37
|
+
thickness={6}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
<View style={{flex: 1, gap: 24}}>
|
|
41
|
+
<Line
|
|
42
|
+
color={context.colors.main[5]}
|
|
43
|
+
orientation={'horizontal'}
|
|
44
|
+
thickness={6}
|
|
45
|
+
/>
|
|
46
|
+
<Line
|
|
47
|
+
color={context.colors.main[9]}
|
|
48
|
+
orientation={'horizontal'}
|
|
49
|
+
thickness={12}
|
|
50
|
+
/>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const Stylesheet = (context, color, orientation, thickness) =>
|
|
4
|
+
StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
backgroundColor: color ? color : context.colors.ui.xlightgrey,
|
|
7
|
+
height: orientation === 'horizontal' ? thickness : '100%',
|
|
8
|
+
width: orientation === 'vertical' ? thickness : '100%',
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`QuickMessage should render
|
|
3
|
+
exports[`QuickMessage should render a quick message that is not selected 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
accessibilityState={
|
|
6
6
|
{
|
|
@@ -70,3 +70,74 @@ exports[`QuickMessage should render correctly 1`] = `
|
|
|
70
70
|
</Text>
|
|
71
71
|
</View>
|
|
72
72
|
`;
|
|
73
|
+
|
|
74
|
+
exports[`QuickMessage should render a quick message that is selected 1`] = `
|
|
75
|
+
<View
|
|
76
|
+
accessibilityState={
|
|
77
|
+
{
|
|
78
|
+
"busy": undefined,
|
|
79
|
+
"checked": undefined,
|
|
80
|
+
"disabled": undefined,
|
|
81
|
+
"expanded": undefined,
|
|
82
|
+
"selected": undefined,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
accessibilityValue={
|
|
86
|
+
{
|
|
87
|
+
"max": undefined,
|
|
88
|
+
"min": undefined,
|
|
89
|
+
"now": undefined,
|
|
90
|
+
"text": undefined,
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
accessible={true}
|
|
94
|
+
collapsable={false}
|
|
95
|
+
focusable={true}
|
|
96
|
+
onBlur={[Function]}
|
|
97
|
+
onClick={[Function]}
|
|
98
|
+
onFocus={[Function]}
|
|
99
|
+
onResponderGrant={[Function]}
|
|
100
|
+
onResponderMove={[Function]}
|
|
101
|
+
onResponderRelease={[Function]}
|
|
102
|
+
onResponderTerminate={[Function]}
|
|
103
|
+
onResponderTerminationRequest={[Function]}
|
|
104
|
+
onStartShouldSetResponder={[Function]}
|
|
105
|
+
style={
|
|
106
|
+
{
|
|
107
|
+
"backgroundColor": "#647ACB",
|
|
108
|
+
"borderBottomLeftRadius": 8,
|
|
109
|
+
"borderBottomRightRadius": 24,
|
|
110
|
+
"borderTopLeftRadius": 24,
|
|
111
|
+
"borderTopRightRadius": 24,
|
|
112
|
+
"paddingBottom": 24,
|
|
113
|
+
"paddingLeft": 24,
|
|
114
|
+
"paddingRight": 24,
|
|
115
|
+
"paddingTop": 24,
|
|
116
|
+
"width": "100%",
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
testID="quick-message-test"
|
|
120
|
+
>
|
|
121
|
+
<Text
|
|
122
|
+
style={
|
|
123
|
+
[
|
|
124
|
+
[
|
|
125
|
+
{
|
|
126
|
+
"fontFamily": "Montserrat",
|
|
127
|
+
"fontSize": 14,
|
|
128
|
+
"lineHeight": 22.4,
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
{
|
|
132
|
+
"color": "#FFFFFF",
|
|
133
|
+
"textAlign": "center",
|
|
134
|
+
"width": "100%",
|
|
135
|
+
},
|
|
136
|
+
undefined,
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
>
|
|
140
|
+
Test message
|
|
141
|
+
</Text>
|
|
142
|
+
</View>
|
|
143
|
+
`;
|
|
@@ -2,10 +2,12 @@ import {PressableProps} from 'react-native';
|
|
|
2
2
|
interface QuickMessageProps extends PressableProps {
|
|
3
3
|
message: string;
|
|
4
4
|
setMessage: (value: string) => void;
|
|
5
|
+
selectedMessage: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const QuickMessage: ({
|
|
7
8
|
message,
|
|
8
9
|
setMessage,
|
|
10
|
+
selectedMessage,
|
|
9
11
|
...props
|
|
10
12
|
}: QuickMessageProps) => JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -7,15 +7,17 @@ import {Stylesheet} from './quick-message.styles';
|
|
|
7
7
|
interface QuickMessageProps extends PressableProps {
|
|
8
8
|
message: string;
|
|
9
9
|
setMessage: (value: string) => void;
|
|
10
|
+
selectedMessage: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const QuickMessage = ({
|
|
13
14
|
message,
|
|
14
15
|
setMessage,
|
|
16
|
+
selectedMessage,
|
|
15
17
|
...props
|
|
16
18
|
}: QuickMessageProps) => {
|
|
17
19
|
const context = useContext(ThemeCtx);
|
|
18
|
-
const styles = Stylesheet(context);
|
|
20
|
+
const styles = Stylesheet(context, selectedMessage);
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
<Pressable
|
|
@@ -15,16 +15,25 @@ export const QuickMessagePreview = () => {
|
|
|
15
15
|
padding: 32,
|
|
16
16
|
}}
|
|
17
17
|
>
|
|
18
|
-
<QuickMessage
|
|
18
|
+
<QuickMessage
|
|
19
|
+
message={'Test message'}
|
|
20
|
+
setMessage={setMessage}
|
|
21
|
+
selectedMessage={message === 'Test message'}
|
|
22
|
+
/>
|
|
19
23
|
<QuickMessage
|
|
20
24
|
message={'Option message number 2'}
|
|
21
25
|
setMessage={setMessage}
|
|
26
|
+
selectedMessage={message === 'Option message number 2'}
|
|
22
27
|
/>
|
|
23
28
|
<QuickMessage
|
|
24
29
|
message={
|
|
25
30
|
'Aan het spelen met mijn vriendjes en vriendinnetjes in de speelhoek'
|
|
26
31
|
}
|
|
27
32
|
setMessage={setMessage}
|
|
33
|
+
selectedMessage={
|
|
34
|
+
message ===
|
|
35
|
+
'Aan het spelen met mijn vriendjes en vriendinnetjes in de speelhoek'
|
|
36
|
+
}
|
|
28
37
|
/>
|
|
29
38
|
|
|
30
39
|
<Text style={{textAlign: 'center'}}>Pressed message: {message}</Text>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {Scale} from '../../../theme/scale/index';
|
|
3
3
|
|
|
4
|
-
export const Stylesheet = (context) =>
|
|
4
|
+
export const Stylesheet = (context, selectedMessage) =>
|
|
5
5
|
StyleSheet.create({
|
|
6
6
|
container: {
|
|
7
7
|
width: '100%',
|
|
8
|
-
backgroundColor:
|
|
8
|
+
backgroundColor: !selectedMessage
|
|
9
|
+
? context.colors.ui.darkgrey
|
|
10
|
+
: context.colors.main['5'],
|
|
9
11
|
paddingTop: Scale.l,
|
|
10
12
|
paddingBottom: Scale.l,
|
|
11
13
|
paddingRight: Scale.l,
|
|
@@ -3,19 +3,51 @@ import {render, fireEvent} from '@testing-library/react-native';
|
|
|
3
3
|
import {QuickMessage} from './quick-message.component';
|
|
4
4
|
|
|
5
5
|
describe('QuickMessage', () => {
|
|
6
|
-
it('should render
|
|
6
|
+
it('should render a quick message that is not selected', () => {
|
|
7
7
|
const {toJSON} = render(
|
|
8
|
-
<QuickMessage
|
|
8
|
+
<QuickMessage
|
|
9
|
+
message="Test message"
|
|
10
|
+
setMessage={() => {}}
|
|
11
|
+
selectedMessage={false}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
expect(toJSON()).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it('should render a quick message that is selected', () => {
|
|
17
|
+
const {toJSON} = render(
|
|
18
|
+
<QuickMessage
|
|
19
|
+
message="Test message"
|
|
20
|
+
setMessage={() => {}}
|
|
21
|
+
selectedMessage={true}
|
|
22
|
+
/>
|
|
9
23
|
);
|
|
10
24
|
expect(toJSON()).toMatchSnapshot();
|
|
11
25
|
});
|
|
12
|
-
});
|
|
13
26
|
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
it('calls setMessage when pressed (selected)', () => {
|
|
28
|
+
const setMessageMock = jest.fn();
|
|
29
|
+
const {getByTestId} = render(
|
|
30
|
+
<QuickMessage
|
|
31
|
+
message="Test message"
|
|
32
|
+
setMessage={setMessageMock}
|
|
33
|
+
selectedMessage={true} // Mocking selectedMessage as true
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const pressable = getByTestId('quick-message-test');
|
|
38
|
+
fireEvent.press(pressable);
|
|
39
|
+
|
|
40
|
+
expect(setMessageMock).toHaveBeenCalledWith('Test message');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('calls setMessage when pressed (not selected)', () => {
|
|
16
44
|
const setMessageMock = jest.fn();
|
|
17
45
|
const {getByTestId} = render(
|
|
18
|
-
<QuickMessage
|
|
46
|
+
<QuickMessage
|
|
47
|
+
message="Test message"
|
|
48
|
+
setMessage={setMessageMock}
|
|
49
|
+
selectedMessage={false} // Mocking selectedMessage as false
|
|
50
|
+
/>
|
|
19
51
|
);
|
|
20
52
|
|
|
21
53
|
const pressable = getByTestId('quick-message-test');
|