react-native-shared-components 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -5
- package/lib/module/assets/theme.js +227 -0
- package/lib/module/assets/theme.js.map +1 -0
- package/lib/module/components/BaseButton/index.js +7 -31
- package/lib/module/components/BaseButton/index.js.map +1 -1
- package/lib/module/components/BaseContainer/index.js +3 -6
- package/lib/module/components/BaseContainer/index.js.map +1 -1
- package/lib/module/components/BaseText/index.js +54 -25
- package/lib/module/components/BaseText/index.js.map +1 -1
- package/lib/module/core/KadoProvider/index.js +27 -0
- package/lib/module/core/KadoProvider/index.js.map +1 -0
- package/lib/module/core/index.js +4 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/assets/theme.d.ts +225 -0
- package/lib/typescript/src/assets/theme.d.ts.map +1 -0
- package/lib/typescript/src/components/BaseButton/index.d.ts +2 -3
- package/lib/typescript/src/components/BaseButton/index.d.ts.map +1 -1
- package/lib/typescript/src/components/BaseContainer/index.d.ts +2 -5
- package/lib/typescript/src/components/BaseContainer/index.d.ts.map +1 -1
- package/lib/typescript/src/components/BaseText/index.d.ts +43 -9
- package/lib/typescript/src/components/BaseText/index.d.ts.map +1 -1
- package/lib/typescript/src/core/KadoProvider/index.d.ts +19 -0
- package/lib/typescript/src/core/KadoProvider/index.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +7 -9
- package/src/assets/theme.ts +285 -0
- package/src/components/BaseButton/index.tsx +9 -35
- package/src/components/BaseContainer/index.tsx +3 -7
- package/src/components/BaseText/index.tsx +56 -36
- package/src/core/KadoProvider/index.tsx +41 -0
- package/src/core/index.tsx +1 -0
- package/src/index.tsx +1 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
export const typographyDefault = {
|
|
2
|
+
'fontFamilies/productFont': 'Manrope',
|
|
3
|
+
|
|
4
|
+
'fontSizes/fs11': 11,
|
|
5
|
+
|
|
6
|
+
'fontSizes/fs12': 12,
|
|
7
|
+
|
|
8
|
+
'fontSizes/fs13': 12,
|
|
9
|
+
|
|
10
|
+
'fontSizes/fs14': 14,
|
|
11
|
+
|
|
12
|
+
'fontSizes/fs16': 16,
|
|
13
|
+
|
|
14
|
+
'fontSizes/fs18': 18,
|
|
15
|
+
|
|
16
|
+
'fontSizes/fs20': 20,
|
|
17
|
+
|
|
18
|
+
'fontSizes/fs24': 24,
|
|
19
|
+
|
|
20
|
+
'fontSizes/fs28': 28,
|
|
21
|
+
|
|
22
|
+
'fontSizes/fs30': 30,
|
|
23
|
+
|
|
24
|
+
'fontSizes/fs36': 36,
|
|
25
|
+
|
|
26
|
+
'fontSizes/fs38': 38,
|
|
27
|
+
|
|
28
|
+
'fontWeights/regular': '400',
|
|
29
|
+
|
|
30
|
+
'fontWeights/medium': '500',
|
|
31
|
+
|
|
32
|
+
'fontWeights/semiBold': '600',
|
|
33
|
+
|
|
34
|
+
'fontWeights/bold': '700',
|
|
35
|
+
|
|
36
|
+
'lineHeights/lh16': 16,
|
|
37
|
+
|
|
38
|
+
'lineHeights/lh18': 18,
|
|
39
|
+
|
|
40
|
+
'lineHeights/lh20': 20,
|
|
41
|
+
|
|
42
|
+
'lineHeights/lh24': 24,
|
|
43
|
+
|
|
44
|
+
'lineHeights/lh26': 26,
|
|
45
|
+
|
|
46
|
+
'lineHeights/lh28': 28,
|
|
47
|
+
|
|
48
|
+
'lineHeights/lh30': 30,
|
|
49
|
+
|
|
50
|
+
'lineHeights/lh32': 32,
|
|
51
|
+
|
|
52
|
+
'lineHeights/lh38': 38,
|
|
53
|
+
|
|
54
|
+
'lineHeights/lh44': 44,
|
|
55
|
+
|
|
56
|
+
'lineHeights/lh60': 60,
|
|
57
|
+
|
|
58
|
+
'lineHeights/lh90': 90,
|
|
59
|
+
|
|
60
|
+
'lineHeights/lh72': 72,
|
|
61
|
+
|
|
62
|
+
'text12/normal': {
|
|
63
|
+
fontFamily: 'fontFamilies/productFont',
|
|
64
|
+
fontWeight: 'fontWeights/regular',
|
|
65
|
+
lineHeight: 'lineHeights/lh16',
|
|
66
|
+
fontSize: 'fontSizes/fs13',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
'text12/medium': {
|
|
70
|
+
fontFamily: 'fontFamilies/productFont',
|
|
71
|
+
fontWeight: 'fontWeights/medium',
|
|
72
|
+
lineHeight: 'lineHeights/lh16',
|
|
73
|
+
fontSize: 'fontSizes/fs12',
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
'text12/semiBold': {
|
|
77
|
+
fontFamily: 'fontFamilies/productFont',
|
|
78
|
+
fontWeight: 'fontWeights/semiBold',
|
|
79
|
+
lineHeight: 'lineHeights/lh16',
|
|
80
|
+
fontSize: 'fontSizes/fs12',
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
'text12/bold': {
|
|
84
|
+
fontFamily: 'fontFamilies/productFont',
|
|
85
|
+
fontWeight: 'fontWeights/bold',
|
|
86
|
+
lineHeight: 'lineHeights/lh16',
|
|
87
|
+
fontSize: 'fontSizes/fs12',
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
'tex14/normal': {
|
|
91
|
+
fontFamily: 'fontFamilies/productFont',
|
|
92
|
+
fontWeight: 'fontWeights/regular',
|
|
93
|
+
lineHeight: 'lineHeights/lh20',
|
|
94
|
+
fontSize: 'fontSizes/fs14',
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
'tex14/medium': {
|
|
98
|
+
fontFamily: 'fontFamilies/productFont',
|
|
99
|
+
fontWeight: 'fontWeights/medium',
|
|
100
|
+
lineHeight: 'lineHeights/lh20',
|
|
101
|
+
fontSize: 'fontSizes/fs14',
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
'tex14/semiBold': {
|
|
105
|
+
fontFamily: 'fontFamilies/productFont',
|
|
106
|
+
fontWeight: 'fontWeights/semiBold',
|
|
107
|
+
lineHeight: 'lineHeights/lh20',
|
|
108
|
+
fontSize: 'fontSizes/fs14',
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
'tex14/bold': {
|
|
112
|
+
fontFamily: 'fontFamilies/productFont',
|
|
113
|
+
fontWeight: 'fontWeights/bold',
|
|
114
|
+
lineHeight: 'lineHeights/lh20',
|
|
115
|
+
fontSize: 'fontSizes/fs14',
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
'text16/normal': {
|
|
119
|
+
fontFamily: 'fontFamilies/productFont',
|
|
120
|
+
fontWeight: 'fontWeights/regular',
|
|
121
|
+
lineHeight: 'lineHeights/lh24',
|
|
122
|
+
fontSize: 'fontSizes/fs16',
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
'text16/medium': {
|
|
126
|
+
fontFamily: 'fontFamilies/productFont',
|
|
127
|
+
fontWeight: 'fontWeights/medium',
|
|
128
|
+
lineHeight: 'lineHeights/lh24',
|
|
129
|
+
fontSize: 'fontSizes/fs16',
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
'text16/semiBold': {
|
|
133
|
+
fontFamily: 'fontFamilies/productFont',
|
|
134
|
+
fontWeight: 'fontWeights/semiBold',
|
|
135
|
+
lineHeight: 'lineHeights/lh24',
|
|
136
|
+
fontSize: 'fontSizes/fs16',
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
'text16/bold': {
|
|
140
|
+
fontFamily: 'fontFamilies/productFont',
|
|
141
|
+
fontWeight: 'fontWeights/bold',
|
|
142
|
+
lineHeight: 'lineHeights/lh24',
|
|
143
|
+
fontSize: 'fontSizes/fs16',
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
'text18/normal': {
|
|
147
|
+
fontFamily: 'fontFamilies/productFont',
|
|
148
|
+
fontWeight: 'fontWeights/regular',
|
|
149
|
+
lineHeight: 'lineHeights/lh26',
|
|
150
|
+
fontSize: 'fontSizes/fs18',
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
'text18/medium': {
|
|
154
|
+
fontFamily: 'fontFamilies/productFont',
|
|
155
|
+
fontWeight: 'fontWeights/medium',
|
|
156
|
+
lineHeight: 'lineHeights/lh26',
|
|
157
|
+
fontSize: 'fontSizes/fs18',
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
'text18/semiBold': {
|
|
161
|
+
fontFamily: 'fontFamilies/productFont',
|
|
162
|
+
fontWeight: 'fontWeights/semiBold',
|
|
163
|
+
lineHeight: 'lineHeights/lh26',
|
|
164
|
+
fontSize: 'fontSizes/fs18',
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
'text18/bold': {
|
|
168
|
+
fontFamily: 'fontFamilies/productFont',
|
|
169
|
+
fontWeight: 'fontWeights/bold',
|
|
170
|
+
lineHeight: 'lineHeights/lh26',
|
|
171
|
+
fontSize: 'fontSizes/fs18',
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
'text20/normal': {
|
|
175
|
+
fontFamily: 'fontFamilies/productFont',
|
|
176
|
+
fontWeight: 'fontWeights/regular',
|
|
177
|
+
lineHeight: 'lineHeights/lh28',
|
|
178
|
+
fontSize: 'fontSizes/fs20',
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
'text20/medium': {
|
|
182
|
+
fontFamily: 'fontFamilies/productFont',
|
|
183
|
+
fontWeight: 'fontWeights/medium',
|
|
184
|
+
lineHeight: 'lineHeights/lh28',
|
|
185
|
+
fontSize: 'fontSizes/fs20',
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
'text20/semiBold': {
|
|
189
|
+
fontFamily: 'fontFamilies/productFont',
|
|
190
|
+
fontWeight: 'fontWeights/semiBold',
|
|
191
|
+
lineHeight: 'lineHeights/lh28',
|
|
192
|
+
fontSize: 'fontSizes/fs20',
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
'text20/bold': {
|
|
196
|
+
fontFamily: 'fontFamilies/productFont',
|
|
197
|
+
fontWeight: 'fontWeights/bold',
|
|
198
|
+
lineHeight: 'lineHeights/lh28',
|
|
199
|
+
fontSize: 'fontSizes/fs20',
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
'text24/normal': {
|
|
203
|
+
fontFamily: 'fontFamilies/productFont',
|
|
204
|
+
fontWeight: 'fontWeights/regular',
|
|
205
|
+
lineHeight: 'lineHeights/lh32',
|
|
206
|
+
fontSize: 'fontSizes/fs24',
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
'text24/medium': {
|
|
210
|
+
fontFamily: 'fontFamilies/productFont',
|
|
211
|
+
fontWeight: 'fontWeights/medium',
|
|
212
|
+
lineHeight: 'lineHeights/lh32',
|
|
213
|
+
fontSize: 'fontSizes/fs24',
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
'text24/semiBold': {
|
|
217
|
+
fontFamily: 'fontFamilies/productFont',
|
|
218
|
+
fontWeight: 'fontWeights/semiBold',
|
|
219
|
+
lineHeight: 'lineHeights/lh32',
|
|
220
|
+
fontSize: 'fontSizes/fs24',
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
'text24/bold': {
|
|
224
|
+
fontFamily: 'fontFamilies/productFont',
|
|
225
|
+
fontWeight: 'fontWeights/bold',
|
|
226
|
+
lineHeight: 'lineHeights/lh32',
|
|
227
|
+
fontSize: 'fontSizes/fs24',
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
'text30/normal': {
|
|
231
|
+
fontFamily: 'fontFamilies/productFont',
|
|
232
|
+
fontWeight: 'fontWeights/regular',
|
|
233
|
+
fontSize: 'fontSizes/fs30',
|
|
234
|
+
lineHeight: 'lineHeights/lh38',
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
'text30/medium': {
|
|
238
|
+
fontFamily: 'fontFamilies/productFont',
|
|
239
|
+
fontWeight: 'fontWeights/medium',
|
|
240
|
+
lineHeight: 'lineHeights/lh38',
|
|
241
|
+
fontSize: 'fontSizes/fs30',
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
'text30/semiBold': {
|
|
245
|
+
fontFamily: 'fontFamilies/productFont',
|
|
246
|
+
fontWeight: 'fontWeights/semiBold',
|
|
247
|
+
lineHeight: 'lineHeights/lh38',
|
|
248
|
+
fontSize: 'fontSizes/fs30',
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
'text30/bold': {
|
|
252
|
+
fontFamily: 'fontFamilies/productFont',
|
|
253
|
+
fontWeight: 'fontWeights/bold',
|
|
254
|
+
lineHeight: 'lineHeights/lh38',
|
|
255
|
+
fontSize: 'fontSizes/fs30',
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
'tex36/normal': {
|
|
259
|
+
fontFamily: 'fontFamilies/productFont',
|
|
260
|
+
fontWeight: 'fontWeights/regular',
|
|
261
|
+
lineHeight: 'lineHeights/lh44',
|
|
262
|
+
fontSize: 'fontSizes/fs36',
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
'tex36/medium': {
|
|
266
|
+
fontFamily: 'fontFamilies/productFont',
|
|
267
|
+
fontWeight: 'fontWeights/medium',
|
|
268
|
+
lineHeight: 'lineHeights/lh44',
|
|
269
|
+
fontSize: 'fontSizes/fs36',
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
'tex36/semiBold': {
|
|
273
|
+
fontFamily: 'fontFamilies/productFont',
|
|
274
|
+
fontWeight: 'fontWeights/semiBold',
|
|
275
|
+
lineHeight: 'lineHeights/lh44',
|
|
276
|
+
fontSize: 'fontSizes/fs36',
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
'tex36/bold': {
|
|
280
|
+
fontFamily: 'fontFamilies/productFont',
|
|
281
|
+
fontWeight: 'fontWeights/bold',
|
|
282
|
+
lineHeight: 'lineHeights/lh44',
|
|
283
|
+
fontSize: 'fontSizes/fs36',
|
|
284
|
+
},
|
|
285
|
+
};
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
type TextStyle,
|
|
8
8
|
type TouchableOpacityProps,
|
|
9
9
|
} from 'react-native';
|
|
10
|
-
import BaseText, { type BaseTextType } from '../BaseText';
|
|
11
10
|
import { Colors } from '../../constants/Colors';
|
|
11
|
+
import { BaseText, type EBaseTextType } from '../BaseText';
|
|
12
12
|
|
|
13
13
|
export type ButtonVariant = 'primary' | 'link-subtle' | 'red' | 'brand-subtle';
|
|
14
14
|
export type ButtonSize = 'small' | 'regular' | 'large';
|
|
15
15
|
export type ButtonType = 'common' | 'icon';
|
|
16
16
|
|
|
17
|
-
interface BaseButtonProps extends Omit<TouchableOpacityProps, 'style'> {
|
|
17
|
+
export interface BaseButtonProps extends Omit<TouchableOpacityProps, 'style'> {
|
|
18
18
|
type?: ButtonType;
|
|
19
19
|
variant?: ButtonVariant;
|
|
20
20
|
size?: ButtonSize;
|
|
@@ -26,7 +26,7 @@ interface BaseButtonProps extends Omit<TouchableOpacityProps, 'style'> {
|
|
|
26
26
|
textStyle?: TextStyle;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const BaseButton: React.FC<BaseButtonProps> = ({
|
|
29
|
+
export const BaseButton: React.FC<BaseButtonProps> = ({
|
|
30
30
|
type = 'common',
|
|
31
31
|
variant = 'primary',
|
|
32
32
|
size = 'regular',
|
|
@@ -40,7 +40,6 @@ const BaseButton: React.FC<BaseButtonProps> = ({
|
|
|
40
40
|
...props
|
|
41
41
|
}) => {
|
|
42
42
|
const sizeStyle = styles[`size_${size}`];
|
|
43
|
-
const textSizeStyle = styles[`text_${size}`];
|
|
44
43
|
const variantStyle = disabled
|
|
45
44
|
? styles.variant_disabled
|
|
46
45
|
: styles[`variant_${variant}`];
|
|
@@ -48,29 +47,16 @@ const BaseButton: React.FC<BaseButtonProps> = ({
|
|
|
48
47
|
? styles.text_disabled
|
|
49
48
|
: styles[`text_variant_${variant}`];
|
|
50
49
|
|
|
51
|
-
const getTextType = ():
|
|
50
|
+
const getTextType = (): EBaseTextType => {
|
|
52
51
|
switch (size) {
|
|
53
52
|
case 'small':
|
|
54
|
-
return '
|
|
53
|
+
return 'tex14/medium';
|
|
55
54
|
case 'regular':
|
|
56
|
-
return '
|
|
55
|
+
return 'text16/semiBold';
|
|
57
56
|
case 'large':
|
|
58
|
-
return '
|
|
57
|
+
return 'text20/semiBold';
|
|
59
58
|
default:
|
|
60
|
-
return '
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const getTextSize = (): number => {
|
|
65
|
-
switch (size) {
|
|
66
|
-
case 'small':
|
|
67
|
-
return 14;
|
|
68
|
-
case 'regular':
|
|
69
|
-
return 16;
|
|
70
|
-
case 'large':
|
|
71
|
-
return 20;
|
|
72
|
-
default:
|
|
73
|
-
return 16;
|
|
59
|
+
return 'text16/semiBold';
|
|
74
60
|
}
|
|
75
61
|
};
|
|
76
62
|
|
|
@@ -131,8 +117,7 @@ const BaseButton: React.FC<BaseButtonProps> = ({
|
|
|
131
117
|
{label && (
|
|
132
118
|
<BaseText
|
|
133
119
|
type={getTextType()}
|
|
134
|
-
|
|
135
|
-
style={[textSizeStyle, textVariantStyle, textStyle]}
|
|
120
|
+
style={[textVariantStyle, textStyle]}
|
|
136
121
|
>
|
|
137
122
|
{label}
|
|
138
123
|
</BaseText>
|
|
@@ -213,15 +198,4 @@ const styles = StyleSheet.create({
|
|
|
213
198
|
'text_disabled': {
|
|
214
199
|
color: Colors.text_disabled_tertiary_light,
|
|
215
200
|
},
|
|
216
|
-
'text_small': {
|
|
217
|
-
fontSize: 14,
|
|
218
|
-
},
|
|
219
|
-
'text_regular': {
|
|
220
|
-
fontSize: 16,
|
|
221
|
-
},
|
|
222
|
-
'text_large': {
|
|
223
|
-
fontSize: 20,
|
|
224
|
-
},
|
|
225
201
|
});
|
|
226
|
-
|
|
227
|
-
export default BaseButton;
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
type TextStyle,
|
|
9
9
|
type ViewStyle,
|
|
10
10
|
type KeyboardAvoidingViewProps,
|
|
11
|
+
Text,
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import { type ReactNode } from 'react';
|
|
13
14
|
import { styles } from './styles';
|
|
14
15
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
15
|
-
import BaseText, { type BaseTextType } from '../BaseText';
|
|
16
16
|
|
|
17
|
-
interface IBaseContainer {
|
|
17
|
+
export interface IBaseContainer {
|
|
18
18
|
title?: string;
|
|
19
19
|
center?: ReactNode;
|
|
20
20
|
right?: ReactNode;
|
|
@@ -31,7 +31,6 @@ interface IBaseContainer {
|
|
|
31
31
|
backgroundColorStatusBar?: ColorValue | undefined;
|
|
32
32
|
edges?: Array<'top' | 'bottom' | 'left' | 'right'>;
|
|
33
33
|
keyboardAvoidingViewProps?: Omit<KeyboardAvoidingViewProps, 'children'>;
|
|
34
|
-
type?: BaseTextType;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
export const BaseContainer = ({
|
|
@@ -51,7 +50,6 @@ export const BaseContainer = ({
|
|
|
51
50
|
styleHeader,
|
|
52
51
|
edges,
|
|
53
52
|
keyboardAvoidingViewProps,
|
|
54
|
-
type = 'Medium',
|
|
55
53
|
}: IBaseContainer) => {
|
|
56
54
|
return (
|
|
57
55
|
<KeyboardAvoidingView
|
|
@@ -82,9 +80,7 @@ export const BaseContainer = ({
|
|
|
82
80
|
{center}
|
|
83
81
|
</TouchableOpacity>
|
|
84
82
|
) : title ? (
|
|
85
|
-
<
|
|
86
|
-
{title}
|
|
87
|
-
</BaseText>
|
|
83
|
+
<Text style={styleTitle}>{title}</Text>
|
|
88
84
|
) : (
|
|
89
85
|
<View />
|
|
90
86
|
)}
|
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Text, type TextProps, type TextStyle } from 'react-native';
|
|
2
|
+
import { useMemo, type ReactNode } from 'react';
|
|
3
|
+
import { useTheme } from '../../core';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const BaseTextTypes = {
|
|
6
|
+
'text12/normal': 'text12/normal',
|
|
7
|
+
'text12/medium': 'text12/medium',
|
|
8
|
+
'text12/semiBold': 'text12/semiBold',
|
|
9
|
+
'text12/bold': 'text12/bold',
|
|
10
|
+
'tex14/normal': 'tex14/normal',
|
|
11
|
+
'tex14/medium': 'tex14/medium',
|
|
12
|
+
'tex14/semiBold': 'tex14/semiBold',
|
|
13
|
+
'tex14/bold': 'tex14/bold',
|
|
14
|
+
'text16/normal': 'text16/normal',
|
|
15
|
+
'text16/medium': 'text16/medium',
|
|
16
|
+
'text16/semiBold': 'text16/semiBold',
|
|
17
|
+
'text16/bold': 'text16/bold',
|
|
18
|
+
'text18/normal': 'text18/normal',
|
|
19
|
+
'text18/medium': 'text18/medium',
|
|
20
|
+
'text18/semiBold': 'text18/semiBold',
|
|
21
|
+
'text18/bold': 'text18/bold',
|
|
22
|
+
'text20/normal': 'text20/normal',
|
|
23
|
+
'text20/medium': 'text20/medium',
|
|
24
|
+
'text20/semiBold': 'text20/semiBold',
|
|
25
|
+
'text20/bold': 'text20/bold',
|
|
26
|
+
'text24/normal': 'text24/normal',
|
|
27
|
+
'text24/medium': 'text24/medium',
|
|
28
|
+
'text24/semiBold': 'text24/semiBold',
|
|
29
|
+
'text24/bold': 'text24/bold',
|
|
30
|
+
'text30/normal': 'text30/normal',
|
|
31
|
+
'text30/medium': 'text30/medium',
|
|
32
|
+
'text30/semiBold': 'text30/semiBold',
|
|
33
|
+
'text30/bold': 'text30/bold',
|
|
34
|
+
'tex36/normal': 'tex36/normal',
|
|
35
|
+
'tex36/medium': 'tex36/medium',
|
|
36
|
+
'tex36/semiBold': 'tex36/semiBold',
|
|
37
|
+
'tex36/bold': 'tex36/bold',
|
|
38
|
+
};
|
|
39
|
+
export type EBaseTextType = keyof typeof BaseTextTypes;
|
|
40
|
+
interface IBaseText extends TextProps {
|
|
41
|
+
type: string | EBaseTextType;
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
styleText?: TextStyle;
|
|
10
44
|
}
|
|
11
|
-
|
|
12
|
-
const BaseText: React.FC<BaseTextProps> = ({
|
|
13
|
-
type = 'Medium',
|
|
14
|
-
size,
|
|
15
|
-
style,
|
|
45
|
+
export const BaseText = ({
|
|
16
46
|
children,
|
|
47
|
+
type,
|
|
48
|
+
styleText,
|
|
17
49
|
...props
|
|
18
|
-
}) => {
|
|
50
|
+
}: IBaseText) => {
|
|
51
|
+
const { typography } = useTheme();
|
|
52
|
+
const textStyle = useMemo(() => {
|
|
53
|
+
return {
|
|
54
|
+
fontSize: typography[typography[type].fontSize],
|
|
55
|
+
fontWeight: typography[typography[type].fontWeight],
|
|
56
|
+
fontFamily: typography[typography[type].fontFamily],
|
|
57
|
+
};
|
|
58
|
+
}, [type, typography]);
|
|
59
|
+
|
|
19
60
|
return (
|
|
20
|
-
<Text
|
|
21
|
-
allowFontScaling={false}
|
|
22
|
-
style={[styles[type], { fontSize: size }, style]}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
61
|
+
<Text style={{ ...textStyle, ...styleText }} {...props}>
|
|
25
62
|
{children}
|
|
26
63
|
</Text>
|
|
27
64
|
);
|
|
28
65
|
};
|
|
29
|
-
|
|
30
|
-
const styles = StyleSheet.create({
|
|
31
|
-
ExtraBold: {
|
|
32
|
-
fontWeight: '700',
|
|
33
|
-
},
|
|
34
|
-
Bold: {
|
|
35
|
-
fontWeight: '600',
|
|
36
|
-
},
|
|
37
|
-
SemiBold: {
|
|
38
|
-
fontWeight: '500',
|
|
39
|
-
},
|
|
40
|
-
Medium: {
|
|
41
|
-
fontWeight: '400',
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export default BaseText;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import { typographyDefault } from '../../assets/theme';
|
|
3
|
+
|
|
4
|
+
type dynamicType = {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
interface ThemeDynamicPart {
|
|
8
|
+
[key: string]: dynamicType;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ThemeContextType extends ThemeDynamicPart {
|
|
12
|
+
typography: dynamicType;
|
|
13
|
+
}
|
|
14
|
+
export interface IThemeProvider {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
value: ThemeContextType;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DefaultTheme = {
|
|
20
|
+
typography: typographyDefault,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const ThemeContext = createContext<ThemeContextType | undefined>(
|
|
24
|
+
DefaultTheme
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const ThemeProvider = ({ children, value }: IThemeProvider) => {
|
|
28
|
+
if (!value) return null;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const useTheme = (): ThemeContextType => {
|
|
36
|
+
const context = useContext(ThemeContext);
|
|
37
|
+
if (!context) {
|
|
38
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
39
|
+
}
|
|
40
|
+
return context;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './KadoProvider';
|
package/src/index.tsx
CHANGED