@tactics/toddle-styleguide 1.2.7 → 1.2.9
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 +5 -0
- package/index.d.ts +3 -1
- package/index.tsx +50 -46
- package/package.json +1 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +628 -1810
- 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 -1
- 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 +1 -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/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 +20 -44
- package/src/components/atoms/text-input/text-input.styles.js +7 -13
- package/src/components/molecules/button/button.styles.d.ts +17 -13
- package/src/components/molecules/day/day.component.tsx +17 -4
- package/src/components/molecules/day/day.styles.d.ts +27 -44
- package/src/components/molecules/day/day.styles.js +14 -17
- package/src/components/molecules/filter-tab/filter-tab.component.d.ts +3 -2
- package/src/components/molecules/filter-tab/filter-tab.component.tsx +9 -5
- package/src/components/molecules/filter-tab/filter-tab.preview.tsx +2 -2
- package/src/components/molecules/filter-tab/filter-tab.test.js +2 -2
- package/src/components/molecules/password-input/password-input.component.tsx +7 -9
- package/src/components/molecules/password-input/password-input.styles.d.ts +27 -26
- package/src/components/molecules/password-input/password-input.styles.js +6 -6
- package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +23 -13
- package/src/components/molecules/search-input/search.component.d.ts +7 -8
- 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 +31 -30
- 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/send-text-bubble.component.tsx +1 -5
- package/src/components/molecules/send-bubble/send-text-bubble.styles.d.ts +58 -74
- package/src/components/molecules/send-bubble/send-text-bubble.styles.js +2 -8
- package/src/components/molecules/timeline/timeline.styles.d.ts +40 -50
- package/src/components/molecules/timeline/timeline.styles.js +2 -2
- 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 -14
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -1
- 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 +12 -0
- package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +35 -41
- package/src/components/organisms/child-list-item/child-list-item.styles.js +2 -5
- 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 +6 -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 +10 -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/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +143 -401
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +4 -5
- 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 +37 -24
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +32 -28
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.js +16 -12
- package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +5 -22
- package/src/components/organisms/person-info-card/person-info-card.component.d.ts +2 -1
- package/src/components/organisms/person-info-card/person-info-card.component.tsx +3 -0
- package/src/components/organisms/tab-view/__snapshots__/tab-view.test.js.snap +421 -0
- package/src/components/organisms/tab-view/tab-view.component.d.ts +11 -0
- package/src/components/organisms/tab-view/tab-view.component.tsx +48 -0
- package/src/components/organisms/tab-view/tab-view.preview.d.ts +1 -0
- package/src/components/organisms/tab-view/tab-view.preview.tsx +36 -0
- package/src/components/organisms/tab-view/tab-view.styles.d.ts +10 -0
- package/src/components/organisms/tab-view/tab-view.styles.js +14 -0
- package/src/components/organisms/tab-view/tab-view.test.js +37 -0
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +2 -1
- package/src/components/organisms/text-bubble/text-bubble.component.tsx +3 -1
- package/src/components/organisms/text-bubble/text-bubble.preview.tsx +8 -4
- package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +1 -0
- package/src/components/organisms/text-bubble/text-bubble.styles.js +2 -0
- package/src/components/templates/modal/components/fade-panel.component.tsx +1 -1
- package/src/components/templates/popover/components/modal/modal.component.d.ts +2 -1
- package/src/components/templates/popover/components/modal/modal.component.tsx +8 -2
- package/src/components/templates/popover/popover.component.d.ts +2 -1
- package/src/components/templates/popover/popover.component.tsx +3 -0
- 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 +10 -2
- 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
|
@@ -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,6 +2,7 @@ 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
|
-
export declare const QuickMessage: ({ message, setMessage, ...props }: QuickMessageProps) => JSX.Element;
|
|
7
|
+
export declare const QuickMessage: ({ message, setMessage, selectedMessage, ...props }: QuickMessageProps) => JSX.Element;
|
|
7
8
|
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');
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import {useContext} from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
View,
|
|
6
5
|
TextInput as NativeTextInput,
|
|
7
6
|
TextInputProps as NativeTextInputProps,
|
|
8
7
|
} from 'react-native';
|
|
@@ -20,14 +19,12 @@ const TextInput = ({keyboardType, border, ...props}: TextInputProps) => {
|
|
|
20
19
|
const styles = Stylesheet(context, border);
|
|
21
20
|
|
|
22
21
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/>
|
|
30
|
-
</View>
|
|
22
|
+
<NativeTextInput
|
|
23
|
+
placeholderTextColor={context.colors.ui.grey}
|
|
24
|
+
style={styles.input}
|
|
25
|
+
keyboardType={keyboardType}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
31
28
|
);
|
|
32
29
|
};
|
|
33
30
|
export {TextInput as TextInput};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {TextInput} from './text-input.component';
|
|
3
3
|
import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
|
|
4
|
-
import {
|
|
4
|
+
import {View} from 'react-native';
|
|
5
5
|
|
|
6
6
|
export const TextInputPreview = ({} = {}) => {
|
|
7
7
|
return (
|
|
8
|
-
<
|
|
8
|
+
<View style={{flex: 1, justifyContent: 'space-around', padding: 32}}>
|
|
9
9
|
<TextInput
|
|
10
10
|
onChangeText={(text: string) =>
|
|
11
11
|
console.log('text is changed to: ' + text)
|
|
@@ -36,6 +36,6 @@ export const TextInputPreview = ({} = {}) => {
|
|
|
36
36
|
onChangeText={(text: string) => console.log('text: ' + text)}
|
|
37
37
|
border={true}
|
|
38
38
|
/>
|
|
39
|
-
</
|
|
39
|
+
</View>
|
|
40
40
|
);
|
|
41
41
|
};
|
|
@@ -1,49 +1,25 @@
|
|
|
1
|
-
export function Stylesheet(
|
|
2
|
-
|
|
3
|
-
border: any
|
|
4
|
-
):
|
|
5
|
-
| StyleSheet.NamedStyles<any>
|
|
6
|
-
| StyleSheet.NamedStyles<{
|
|
7
|
-
container: (
|
|
8
|
-
| {
|
|
9
|
-
width: string;
|
|
10
|
-
height: number;
|
|
11
|
-
borderRadius: number;
|
|
12
|
-
overflow: string;
|
|
13
|
-
paddingLeft: number;
|
|
14
|
-
paddingTop: number;
|
|
15
|
-
paddingRight: number;
|
|
16
|
-
paddingBottom: number;
|
|
17
|
-
backgroundColor: any;
|
|
18
|
-
justifyContent: string;
|
|
19
|
-
alignItems: string;
|
|
20
|
-
borderStyle?: undefined;
|
|
21
|
-
borderWidth?: undefined;
|
|
22
|
-
borderColor?: undefined;
|
|
23
|
-
}
|
|
24
|
-
| {
|
|
25
|
-
borderStyle: string;
|
|
26
|
-
borderWidth: number;
|
|
27
|
-
borderColor: any;
|
|
28
|
-
width?: undefined;
|
|
29
|
-
height?: undefined;
|
|
30
|
-
borderRadius?: undefined;
|
|
31
|
-
overflow?: undefined;
|
|
32
|
-
paddingLeft?: undefined;
|
|
33
|
-
paddingTop?: undefined;
|
|
34
|
-
paddingRight?: undefined;
|
|
35
|
-
paddingBottom?: undefined;
|
|
36
|
-
backgroundColor?: undefined;
|
|
37
|
-
justifyContent?: undefined;
|
|
38
|
-
alignItems?: undefined;
|
|
39
|
-
}
|
|
40
|
-
)[];
|
|
41
|
-
input: {
|
|
1
|
+
export function Stylesheet(context: any, border: any): StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
2
|
+
input: ({
|
|
42
3
|
lineHeight: number;
|
|
43
4
|
color: any;
|
|
5
|
+
paddingLeft: number;
|
|
6
|
+
paddingTop: number;
|
|
7
|
+
paddingRight: number;
|
|
8
|
+
paddingBottom: number;
|
|
9
|
+
backgroundColor: any;
|
|
10
|
+
borderRadius: number;
|
|
44
11
|
fontFamily: string;
|
|
45
12
|
fontSize: number;
|
|
13
|
+
height: number;
|
|
46
14
|
width: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
15
|
+
justifyContent: string;
|
|
16
|
+
borderStyle?: undefined;
|
|
17
|
+
borderWidth?: undefined;
|
|
18
|
+
borderColor?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
borderStyle: string;
|
|
21
|
+
borderWidth: number;
|
|
22
|
+
borderColor: any;
|
|
23
|
+
})[];
|
|
24
|
+
}>;
|
|
25
|
+
import { StyleSheet } from "react-native/Libraries/StyleSheet/StyleSheet";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
import {StyleSheet} from 'react-native';
|
|
4
3
|
import {Scale} from '../../../theme/scale';
|
|
5
4
|
import {Font} from '../../../theme/font';
|
|
6
5
|
|
|
7
6
|
export const Stylesheet = (context, border) =>
|
|
8
7
|
StyleSheet.create({
|
|
9
|
-
|
|
8
|
+
input: [
|
|
10
9
|
{
|
|
10
|
+
height: Scale.m * 2.75,
|
|
11
11
|
width: '100%',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
...Font.medium,
|
|
14
|
+
lineHeight: 20,
|
|
15
|
+
color: context.colors.ui.black,
|
|
15
16
|
paddingLeft: Scale.m,
|
|
16
17
|
paddingTop: Scale.xs,
|
|
17
18
|
paddingRight: Scale.m,
|
|
18
19
|
paddingBottom: Scale.xs,
|
|
19
20
|
backgroundColor: context.colors.ui.white,
|
|
20
|
-
|
|
21
|
-
alignItems: 'flex-start',
|
|
21
|
+
borderRadius: Scale.xs,
|
|
22
22
|
},
|
|
23
23
|
border && {
|
|
24
24
|
borderStyle: 'solid',
|
|
@@ -26,10 +26,4 @@ export const Stylesheet = (context, border) =>
|
|
|
26
26
|
borderColor: context.colors.ui.lightgrey,
|
|
27
27
|
},
|
|
28
28
|
],
|
|
29
|
-
input: {
|
|
30
|
-
width: '100%',
|
|
31
|
-
...Font.medium,
|
|
32
|
-
lineHeight: 20,
|
|
33
|
-
color: context.colors.ui.black,
|
|
34
|
-
},
|
|
35
29
|
});
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
export function Stylesheet(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export function Stylesheet(
|
|
2
|
+
context: any,
|
|
3
|
+
disabled: any,
|
|
4
|
+
buttonColor: any
|
|
5
|
+
): {
|
|
6
|
+
container: {
|
|
7
|
+
backgroundColor: any;
|
|
8
|
+
paddingVertical: number;
|
|
9
|
+
paddingHorizontal: number;
|
|
10
|
+
flexDirection: 'row';
|
|
11
|
+
justifyContent: 'center';
|
|
12
|
+
alignItems: 'center';
|
|
13
|
+
borderRadius: number;
|
|
14
|
+
};
|
|
15
|
+
iconGap: {
|
|
16
|
+
marginRight: number;
|
|
17
|
+
};
|
|
14
18
|
};
|
|
@@ -20,12 +20,17 @@ const Day = ({onSelect, date, isSelected}: DayProps) => {
|
|
|
20
20
|
ToddleDateTime.now().toFormat('yyyy-MM-dd')
|
|
21
21
|
);
|
|
22
22
|
};
|
|
23
|
-
const styles = Stylesheet(context, isSelected
|
|
23
|
+
const styles = Stylesheet(context, isSelected);
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<View style={styles.container}>
|
|
27
27
|
<View style={styles.dayNameContainer}>
|
|
28
|
-
<Heading4
|
|
28
|
+
<Heading4
|
|
29
|
+
textColor={
|
|
30
|
+
isToday() ? context.colors.main[5] : context.colors.ui.grey
|
|
31
|
+
}
|
|
32
|
+
bold={isToday()}
|
|
33
|
+
>
|
|
29
34
|
{date.weekdayShort.toUpperCase().slice(0, 2)}
|
|
30
35
|
</Heading4>
|
|
31
36
|
</View>
|
|
@@ -33,7 +38,11 @@ const Day = ({onSelect, date, isSelected}: DayProps) => {
|
|
|
33
38
|
<Pressable style={styles.dayCircle} onPress={() => onSelect(date)}>
|
|
34
39
|
<Heading4
|
|
35
40
|
textColor={
|
|
36
|
-
isSelected
|
|
41
|
+
isSelected
|
|
42
|
+
? context.colors.main[9]
|
|
43
|
+
: !isSelected && isToday()
|
|
44
|
+
? context.colors.main[5]
|
|
45
|
+
: context.colors.ui.grey
|
|
37
46
|
}
|
|
38
47
|
textAlign={'center'}
|
|
39
48
|
>
|
|
@@ -42,7 +51,11 @@ const Day = ({onSelect, date, isSelected}: DayProps) => {
|
|
|
42
51
|
|
|
43
52
|
<TinyText
|
|
44
53
|
textColor={
|
|
45
|
-
isSelected
|
|
54
|
+
isSelected
|
|
55
|
+
? context.colors.main[9]
|
|
56
|
+
: !isSelected && isToday()
|
|
57
|
+
? context.colors.main[5]
|
|
58
|
+
: context.colors.ui.grey
|
|
46
59
|
}
|
|
47
60
|
textAlign={'center'}
|
|
48
61
|
>
|
|
@@ -1,44 +1,27 @@
|
|
|
1
|
-
export function Stylesheet(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
fontFamily: string;
|
|
29
|
-
fontSize: number;
|
|
30
|
-
lineHeight: number;
|
|
31
|
-
};
|
|
32
|
-
selectedDate: {
|
|
33
|
-
color: any;
|
|
34
|
-
};
|
|
35
|
-
dayNameContainer: {
|
|
36
|
-
marginBottom: number;
|
|
37
|
-
};
|
|
38
|
-
dayName: {
|
|
39
|
-
color: any;
|
|
40
|
-
fontFamily: string;
|
|
41
|
-
fontSize: number;
|
|
42
|
-
lineHeight: number;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
1
|
+
export function Stylesheet(context: any, isSelected: any): StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
2
|
+
container: {
|
|
3
|
+
alignItems: "center";
|
|
4
|
+
justifyContent: "center";
|
|
5
|
+
};
|
|
6
|
+
dayCircle: ({
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
borderRadius: number;
|
|
10
|
+
padding: number;
|
|
11
|
+
alignItems: string;
|
|
12
|
+
justifyContent: string;
|
|
13
|
+
backgroundColor?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
backgroundColor: any;
|
|
16
|
+
width?: undefined;
|
|
17
|
+
height?: undefined;
|
|
18
|
+
borderRadius?: undefined;
|
|
19
|
+
padding?: undefined;
|
|
20
|
+
alignItems?: undefined;
|
|
21
|
+
justifyContent?: undefined;
|
|
22
|
+
})[];
|
|
23
|
+
dayNameContainer: {
|
|
24
|
+
marginBottom: number;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
import { StyleSheet } from "react-native/Libraries/StyleSheet/StyleSheet";
|
|
@@ -2,28 +2,25 @@ import React from 'react';
|
|
|
2
2
|
import {StyleSheet} from 'react-native';
|
|
3
3
|
import {Scale} from '../../../theme/scale';
|
|
4
4
|
|
|
5
|
-
export const Stylesheet = (context, isSelected
|
|
5
|
+
export const Stylesheet = (context, isSelected) =>
|
|
6
6
|
StyleSheet.create({
|
|
7
7
|
container: {
|
|
8
8
|
alignItems: 'center',
|
|
9
9
|
justifyContent: 'center',
|
|
10
|
-
backgroundColor: context.colors.ui.xlightgrey,
|
|
11
|
-
},
|
|
12
|
-
dayCircle: {
|
|
13
|
-
width: Scale.xxl,
|
|
14
|
-
height: Scale.xxl,
|
|
15
|
-
borderRadius: Scale.xxl / 2,
|
|
16
|
-
padding: Scale.s,
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
backgroundColor: isSelected
|
|
20
|
-
? context.colors.main[5]
|
|
21
|
-
: context.colors.ui.xlightgrey,
|
|
22
|
-
borderColor: isToday
|
|
23
|
-
? context.colors.ui.grey
|
|
24
|
-
: context.colors.ui.xlightgrey,
|
|
25
|
-
borderWidth: 1,
|
|
26
10
|
},
|
|
11
|
+
dayCircle: [
|
|
12
|
+
{
|
|
13
|
+
width: Scale.xxl,
|
|
14
|
+
height: Scale.xxl,
|
|
15
|
+
borderRadius: Scale.xxl / 2,
|
|
16
|
+
padding: Scale.s,
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
},
|
|
20
|
+
isSelected && {
|
|
21
|
+
backgroundColor: context.colors.main[5],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
27
24
|
dayNameContainer: {
|
|
28
25
|
marginBottom: Scale.s,
|
|
29
26
|
},
|
|
@@ -3,7 +3,8 @@ type FilterTab = {
|
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}[];
|
|
6
|
-
|
|
6
|
+
setFilterValue: (value: string) => void;
|
|
7
|
+
setActivePage?: (index: number) => void;
|
|
7
8
|
};
|
|
8
|
-
export declare const FilterTab: ({ tabItem,
|
|
9
|
+
export declare const FilterTab: ({ tabItem, setFilterValue, setActivePage, }: FilterTab) => JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -11,15 +11,19 @@ type FilterTab = {
|
|
|
11
11
|
value: string;
|
|
12
12
|
label: string;
|
|
13
13
|
}[];
|
|
14
|
-
|
|
14
|
+
setFilterValue: (value: string) => void;
|
|
15
|
+
setActivePage?: (index: number) => void;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export const FilterTab = ({
|
|
18
|
+
export const FilterTab = ({
|
|
19
|
+
tabItem,
|
|
20
|
+
setFilterValue,
|
|
21
|
+
setActivePage,
|
|
22
|
+
}: FilterTab) => {
|
|
18
23
|
const [dimensions, setDimensions] = useState({width: 0, height: 0});
|
|
19
24
|
const [translateValue] = useState(new Animated.Value(0));
|
|
20
25
|
|
|
21
26
|
const [clickedButton, setClickedButton] = useState(0);
|
|
22
|
-
const [isActive, setIsActive] = useState(false);
|
|
23
27
|
|
|
24
28
|
// Default from design.
|
|
25
29
|
const minTabWidth = 95;
|
|
@@ -55,9 +59,9 @@ export const FilterTab = ({tabItem, filterValue}: FilterTab) => {
|
|
|
55
59
|
style={styles.tab}
|
|
56
60
|
onPress={() => {
|
|
57
61
|
setClickedButton(index);
|
|
58
|
-
setIsActive(!isActive);
|
|
59
62
|
translateTab(index, inRow);
|
|
60
|
-
|
|
63
|
+
setFilterValue(tab.value);
|
|
64
|
+
setActivePage ? setActivePage(index) : null;
|
|
61
65
|
}}
|
|
62
66
|
>
|
|
63
67
|
<Heading4
|
|
@@ -70,10 +70,10 @@ export const FilterTabPreview = ({}: {}) => {
|
|
|
70
70
|
marginBottom: 20,
|
|
71
71
|
}}
|
|
72
72
|
>
|
|
73
|
-
<FilterTab tabItem={tabs}
|
|
73
|
+
<FilterTab tabItem={tabs} setFilterValue={setFilterValue} />
|
|
74
74
|
</View>
|
|
75
75
|
<View>
|
|
76
|
-
<FilterTab tabItem={data}
|
|
76
|
+
<FilterTab tabItem={data} setFilterValue={setFilterValue} />
|
|
77
77
|
</View>
|
|
78
78
|
</View>
|
|
79
79
|
);
|
|
@@ -15,7 +15,7 @@ describe('Filter tab test', () => {
|
|
|
15
15
|
},
|
|
16
16
|
];
|
|
17
17
|
const tree = render
|
|
18
|
-
.create(<FilterTab tabItem={tabs1}
|
|
18
|
+
.create(<FilterTab tabItem={tabs1} setFilterValue={() => 'NFC'} />)
|
|
19
19
|
.toJSON();
|
|
20
20
|
expect(tree).toMatchSnapshot();
|
|
21
21
|
});
|
|
@@ -35,7 +35,7 @@ describe('Filter tab test', () => {
|
|
|
35
35
|
},
|
|
36
36
|
];
|
|
37
37
|
const tree = render
|
|
38
|
-
.create(<FilterTab tabItem={tabs2}
|
|
38
|
+
.create(<FilterTab tabItem={tabs2} setFilterValue={() => 'M'} />)
|
|
39
39
|
.toJSON();
|
|
40
40
|
expect(tree).toMatchSnapshot();
|
|
41
41
|
});
|