vpt-sebraeds 0.0.49 → 0.0.51
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/components/Tools/NavigationButton/NavigationButton.stories.jsx +6 -8
- package/components/Tools/NavigationButton/index.jsx +48 -39
- package/components/Tools/SearchResult/SearchResult.stories.jsx +0 -6
- package/components/Tools/SearchResult/index.jsx +16 -24
- package/dist/components/Tools/NavigationButton/index.d.ts +3 -1
- package/dist/components/Tools/NavigationButton/index.d.ts.map +1 -1
- package/dist/components/Tools/NavigationButton/index.js +40 -36
- package/dist/components/Tools/SearchResult/index.d.ts.map +1 -1
- package/dist/components/Tools/SearchResult/index.js +14 -22
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ export const Default = {
|
|
|
23
23
|
{/* Dois botões */}
|
|
24
24
|
<NavigationButton
|
|
25
25
|
title="Tool's Name"
|
|
26
|
-
description="Lorem ipsum dolor sit amet,
|
|
26
|
+
description="Lorem ipsum dolor sit amet, sed do elit."
|
|
27
27
|
labels={[
|
|
28
28
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
29
29
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
@@ -34,7 +34,7 @@ export const Default = {
|
|
|
34
34
|
{/* Um botão */}
|
|
35
35
|
<NavigationButton
|
|
36
36
|
title="Tool's Name"
|
|
37
|
-
description="Lorem ipsum dolor sit amet
|
|
37
|
+
description="Lorem ipsum dolor sit amet."
|
|
38
38
|
labels={[
|
|
39
39
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
40
40
|
]}
|
|
@@ -44,7 +44,7 @@ export const Default = {
|
|
|
44
44
|
{/* Sem botão */}
|
|
45
45
|
<NavigationButton
|
|
46
46
|
title="Tool's Name"
|
|
47
|
-
description="Lorem ipsum dolor sit amet,
|
|
47
|
+
description="Lorem ipsum dolor sit amet, consecte adipiscing elit. Suspendisse et quam sit.."
|
|
48
48
|
labels={[]}
|
|
49
49
|
style={{ marginBottom: 32 }}
|
|
50
50
|
/>
|
|
@@ -57,24 +57,22 @@ export const Default = {
|
|
|
57
57
|
{/* default status */}
|
|
58
58
|
<NavigationButton
|
|
59
59
|
title="Tool's Name"
|
|
60
|
-
description="Lorem ipsum dolor sit amet,
|
|
60
|
+
description="Lorem ipsum dolor sit amet, sed."
|
|
61
61
|
labels={[
|
|
62
62
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
63
63
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
64
64
|
]}
|
|
65
|
-
variant="filled"
|
|
66
65
|
style={{ marginBottom: 12 }}
|
|
67
66
|
/>
|
|
68
67
|
|
|
69
68
|
{/* alert status */}
|
|
70
69
|
<NavigationButton
|
|
71
70
|
title="Tool's Name"
|
|
72
|
-
alertMessage="
|
|
71
|
+
alertMessage="Verifique seus dados."
|
|
73
72
|
labels={[
|
|
74
73
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
75
74
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
76
75
|
]}
|
|
77
|
-
variant="filled"
|
|
78
76
|
style={{ marginBottom: 12 }}
|
|
79
77
|
/>
|
|
80
78
|
|
|
@@ -126,7 +124,7 @@ export const Default = {
|
|
|
126
124
|
</SEText>
|
|
127
125
|
<NavigationButton
|
|
128
126
|
title="Tool's Name"
|
|
129
|
-
alertMessage="
|
|
127
|
+
alertMessage="Sua conta precisa de atenção imediata."
|
|
130
128
|
labels={[
|
|
131
129
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
132
130
|
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, Pressable } from 'react-native';
|
|
3
3
|
import SEText from '../../SEText';
|
|
4
4
|
import Icon from '../../Icon';
|
|
5
5
|
import SEIcon from '../../SEIcon';
|
|
@@ -25,10 +25,12 @@ const NavigationButton = ({
|
|
|
25
25
|
// Título
|
|
26
26
|
titleType = 'ns-sm-body-bold',
|
|
27
27
|
titleColor = '#1B244B',
|
|
28
|
+
titleLineHeight = 20,
|
|
28
29
|
|
|
29
30
|
// Descrição
|
|
30
|
-
descriptionType = 'ns-
|
|
31
|
+
descriptionType = 'ns-xxs-body',
|
|
31
32
|
descriptionColor = '#485274',
|
|
33
|
+
descriptionLineHeight = 18,
|
|
32
34
|
|
|
33
35
|
// Alerta
|
|
34
36
|
alertIconName = 'alert-line',
|
|
@@ -48,10 +50,10 @@ const NavigationButton = ({
|
|
|
48
50
|
|
|
49
51
|
// Labels
|
|
50
52
|
labels = [],
|
|
51
|
-
labelTextType = 'ns-
|
|
52
|
-
labelTextColor = '#
|
|
53
|
+
labelTextType = 'ns-sm-body-semibold',
|
|
54
|
+
labelTextColor = '#2A4FDA',
|
|
53
55
|
labelIconSize = 16,
|
|
54
|
-
labelIconColor = '#
|
|
56
|
+
labelIconColor = '#2A4FDA',
|
|
55
57
|
|
|
56
58
|
// Dividers
|
|
57
59
|
dividerColor = '#E2E9FC',
|
|
@@ -71,15 +73,16 @@ const NavigationButton = ({
|
|
|
71
73
|
onPress,
|
|
72
74
|
style,
|
|
73
75
|
}) => {
|
|
74
|
-
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
|
|
76
|
+
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon, onPress }
|
|
75
77
|
const normalizeLabel = (label) => {
|
|
76
78
|
if (typeof label === 'string') {
|
|
77
|
-
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
|
|
79
|
+
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line', onPress: null };
|
|
78
80
|
}
|
|
79
81
|
return {
|
|
80
82
|
text: label.text || 'Label',
|
|
81
83
|
leftIcon: label.leftIcon,
|
|
82
84
|
rightIcon: label.rightIcon,
|
|
85
|
+
onPress: label.onPress || null,
|
|
83
86
|
};
|
|
84
87
|
};
|
|
85
88
|
|
|
@@ -139,7 +142,7 @@ const NavigationButton = ({
|
|
|
139
142
|
<SEText
|
|
140
143
|
type={descriptionType}
|
|
141
144
|
color={descriptionColor}
|
|
142
|
-
style={styles.description}
|
|
145
|
+
style={[styles.description, { lineHeight: descriptionLineHeight }]}
|
|
143
146
|
>
|
|
144
147
|
{description}
|
|
145
148
|
</SEText>
|
|
@@ -151,30 +154,40 @@ const NavigationButton = ({
|
|
|
151
154
|
|
|
152
155
|
const labelsDividerStyle = {
|
|
153
156
|
height: 1,
|
|
154
|
-
backgroundColor:
|
|
155
|
-
marginTop:
|
|
157
|
+
backgroundColor: '#E2E9FC',
|
|
158
|
+
marginTop: 24,
|
|
156
159
|
marginLeft: -(iconContainerSize + 16),
|
|
157
|
-
marginRight: -
|
|
160
|
+
marginRight: -(8 + arrowIconSize + 15),
|
|
158
161
|
};
|
|
159
162
|
|
|
160
163
|
const labelsContainerStyle = {
|
|
161
164
|
flexDirection: 'row',
|
|
162
165
|
marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
|
|
163
|
-
marginRight: -(paddingHorizontal +
|
|
166
|
+
marginRight: -(paddingHorizontal + 8 + arrowIconSize + 15),
|
|
164
167
|
marginBottom: -paddingVertical,
|
|
165
|
-
paddingBottom: 12,
|
|
166
168
|
backgroundColor: '#FFFFFF',
|
|
167
|
-
borderBottomLeftRadius: borderRadius,
|
|
168
|
-
borderBottomRightRadius: borderRadius,
|
|
169
|
+
borderBottomLeftRadius: borderRadius - 1,
|
|
170
|
+
borderBottomRightRadius: borderRadius - 1,
|
|
171
|
+
overflow: 'hidden',
|
|
169
172
|
};
|
|
170
173
|
|
|
171
174
|
const labelVerticalDividerStyle = {
|
|
172
175
|
width: 1,
|
|
173
|
-
backgroundColor:
|
|
176
|
+
backgroundColor: '#E2E9FC',
|
|
174
177
|
marginTop: 8,
|
|
175
178
|
marginBottom: 0,
|
|
176
179
|
};
|
|
177
180
|
|
|
181
|
+
const getLabelButtonStyle = (pressed) => ({
|
|
182
|
+
flex: 1,
|
|
183
|
+
flexDirection: 'row',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
justifyContent: 'center',
|
|
186
|
+
paddingTop: 16,
|
|
187
|
+
paddingBottom: 12,
|
|
188
|
+
backgroundColor: pressed ? '#F5F7FA' : 'transparent',
|
|
189
|
+
});
|
|
190
|
+
|
|
178
191
|
return (
|
|
179
192
|
<>
|
|
180
193
|
<View style={labelsDividerStyle} />
|
|
@@ -184,7 +197,10 @@ const NavigationButton = ({
|
|
|
184
197
|
return (
|
|
185
198
|
<React.Fragment key={index}>
|
|
186
199
|
{index > 0 && <View style={labelVerticalDividerStyle} />}
|
|
187
|
-
<
|
|
200
|
+
<Pressable
|
|
201
|
+
style={({ pressed }) => getLabelButtonStyle(pressed)}
|
|
202
|
+
onPress={normalizedLabel.onPress}
|
|
203
|
+
>
|
|
188
204
|
{normalizedLabel.leftIcon && (
|
|
189
205
|
<Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor} />
|
|
190
206
|
)}
|
|
@@ -192,9 +208,9 @@ const NavigationButton = ({
|
|
|
192
208
|
{normalizedLabel.text}
|
|
193
209
|
</SEText>
|
|
194
210
|
{normalizedLabel.rightIcon && (
|
|
195
|
-
<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft:
|
|
211
|
+
<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 8 }} />
|
|
196
212
|
)}
|
|
197
|
-
</
|
|
213
|
+
</Pressable>
|
|
198
214
|
</React.Fragment>
|
|
199
215
|
);
|
|
200
216
|
})}
|
|
@@ -203,18 +219,18 @@ const NavigationButton = ({
|
|
|
203
219
|
);
|
|
204
220
|
};
|
|
205
221
|
|
|
206
|
-
const
|
|
222
|
+
const getContainerStyle = (pressed) => ({
|
|
207
223
|
flexDirection: 'row',
|
|
208
224
|
alignItems: 'flex-start',
|
|
209
|
-
backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
|
|
225
|
+
backgroundColor: variant === 'filled' || pressed ? filledBackgroundColor : backgroundColor,
|
|
210
226
|
paddingHorizontal,
|
|
211
227
|
paddingVertical,
|
|
212
228
|
minHeight,
|
|
213
229
|
width: '100%',
|
|
214
|
-
borderWidth
|
|
230
|
+
borderWidth,
|
|
215
231
|
borderColor,
|
|
216
232
|
borderRadius,
|
|
217
|
-
};
|
|
233
|
+
});
|
|
218
234
|
|
|
219
235
|
const iconContainerStyle = {
|
|
220
236
|
marginRight: 16,
|
|
@@ -234,10 +250,9 @@ const NavigationButton = ({
|
|
|
234
250
|
};
|
|
235
251
|
|
|
236
252
|
return (
|
|
237
|
-
<
|
|
238
|
-
style={[
|
|
253
|
+
<Pressable
|
|
254
|
+
style={({ pressed }) => [getContainerStyle(pressed), style]}
|
|
239
255
|
onPress={onPress}
|
|
240
|
-
activeOpacity={0.7}
|
|
241
256
|
>
|
|
242
257
|
<View style={iconContainerStyle}>
|
|
243
258
|
{isCustomIcon ? (
|
|
@@ -253,7 +268,7 @@ const NavigationButton = ({
|
|
|
253
268
|
<SEText
|
|
254
269
|
type={titleType}
|
|
255
270
|
color={titleColor}
|
|
256
|
-
style={styles.title}
|
|
271
|
+
style={[styles.title, { lineHeight: titleLineHeight }]}
|
|
257
272
|
>
|
|
258
273
|
{title}
|
|
259
274
|
</SEText>
|
|
@@ -266,7 +281,7 @@ const NavigationButton = ({
|
|
|
266
281
|
<Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor} />
|
|
267
282
|
</View>
|
|
268
283
|
)}
|
|
269
|
-
</
|
|
284
|
+
</Pressable>
|
|
270
285
|
);
|
|
271
286
|
};
|
|
272
287
|
|
|
@@ -276,7 +291,7 @@ const styles = StyleSheet.create({
|
|
|
276
291
|
justifyContent: 'flex-start',
|
|
277
292
|
},
|
|
278
293
|
title: {
|
|
279
|
-
marginBottom:
|
|
294
|
+
marginBottom: 8,
|
|
280
295
|
},
|
|
281
296
|
description: {
|
|
282
297
|
lineHeight: 20,
|
|
@@ -295,22 +310,16 @@ const styles = StyleSheet.create({
|
|
|
295
310
|
valueText: {
|
|
296
311
|
marginLeft: 4,
|
|
297
312
|
},
|
|
298
|
-
labelButton: {
|
|
299
|
-
flex: 1,
|
|
300
|
-
flexDirection: 'row',
|
|
301
|
-
alignItems: 'center',
|
|
302
|
-
justifyContent: 'center',
|
|
303
|
-
paddingTop: 16,
|
|
304
|
-
paddingBottom: 4,
|
|
305
|
-
},
|
|
306
313
|
labelText: {
|
|
307
|
-
marginLeft:
|
|
314
|
+
marginLeft: 8,
|
|
308
315
|
},
|
|
309
316
|
arrowContainer: {
|
|
310
|
-
marginLeft:
|
|
317
|
+
marginLeft: 8,
|
|
318
|
+
marginRight: 15,
|
|
311
319
|
justifyContent: 'flex-start',
|
|
312
320
|
alignItems: 'center',
|
|
313
321
|
paddingTop: 2,
|
|
322
|
+
flexShrink: 0,
|
|
314
323
|
},
|
|
315
324
|
});
|
|
316
325
|
|
|
@@ -85,33 +85,27 @@ export const Default = {
|
|
|
85
85
|
title="Boleto DAS-MEI"
|
|
86
86
|
description="Seu histórico de pagamentos mensais e boletos DAS-MEI em um só lugar."
|
|
87
87
|
iconType="boletoDasMei"
|
|
88
|
-
variant="default"
|
|
89
88
|
/>
|
|
90
89
|
<SearchResult
|
|
91
90
|
title="Fluxo de caixa"
|
|
92
91
|
description="Registre suas entradas e saídas e controle suas finanças com nossa ferramenta gratuita."
|
|
93
92
|
iconType="fluxoCaixa"
|
|
94
|
-
variant="default"
|
|
95
93
|
/>
|
|
96
94
|
<SearchResult
|
|
97
95
|
title="Meu capital de giro"
|
|
98
96
|
description="Calcule quanto você precisa ter disponível em caixa para manter sua empresa funcionando com tranquilidade."
|
|
99
97
|
iconType="capitalGiro"
|
|
100
|
-
variant="filled"
|
|
101
|
-
style={{ marginVertical: 8 }}
|
|
102
98
|
/>
|
|
103
99
|
<SearchResult
|
|
104
100
|
title="Simulador de empréstimo"
|
|
105
101
|
description="Informe o valor, prazo e juros de um possível empréstimo e descubra o valor das parcelas."
|
|
106
102
|
iconType="simuladorEmprestimo"
|
|
107
|
-
variant="default"
|
|
108
103
|
/>
|
|
109
104
|
<SearchResult
|
|
110
105
|
title="PNbox - Plano de negócio"
|
|
111
106
|
description="Conheça seu público e crie um plano de negócio completo. Crie do zero ou adapte modelos para se destacar no mercado."
|
|
112
107
|
iconType="planoNegocios"
|
|
113
108
|
variant="filled"
|
|
114
|
-
style={{ marginVertical: 8 }}
|
|
115
109
|
/>
|
|
116
110
|
</View>
|
|
117
111
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, Pressable } from 'react-native';
|
|
3
3
|
import SEText from '../../SEText';
|
|
4
4
|
import Icon from '../../Icon';
|
|
5
5
|
import SEIcon from '../../SEIcon';
|
|
@@ -16,15 +16,22 @@ const SearchResult = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
18
18
|
|
|
19
|
+
const getContainerStyle = (pressed) => ({
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
alignItems: 'flex-start',
|
|
22
|
+
backgroundColor: variant === 'filled' || pressed ? '#E2E9FC' : '#FFFFFF',
|
|
23
|
+
paddingHorizontal: 12,
|
|
24
|
+
paddingVertical: 16,
|
|
25
|
+
minHeight: 92,
|
|
26
|
+
width: '100%',
|
|
27
|
+
borderBottomWidth: variant === 'filled' ? 0 : 1,
|
|
28
|
+
borderBottomColor: '#E2E9FC',
|
|
29
|
+
});
|
|
30
|
+
|
|
19
31
|
return (
|
|
20
|
-
<
|
|
21
|
-
style={[
|
|
22
|
-
styles.container,
|
|
23
|
-
variant === 'filled' && styles.containerFilled,
|
|
24
|
-
style,
|
|
25
|
-
]}
|
|
32
|
+
<Pressable
|
|
33
|
+
style={({ pressed }) => [getContainerStyle(pressed), style]}
|
|
26
34
|
onPress={onPress}
|
|
27
|
-
activeOpacity={0.7}
|
|
28
35
|
>
|
|
29
36
|
<View style={styles.iconContainer}>
|
|
30
37
|
{isCustomIcon ? (
|
|
@@ -58,26 +65,11 @@ const SearchResult = ({
|
|
|
58
65
|
<Icon name="arrow-right-line" size={20} color="#1B244B" />
|
|
59
66
|
</View>
|
|
60
67
|
)}
|
|
61
|
-
</
|
|
68
|
+
</Pressable>
|
|
62
69
|
);
|
|
63
70
|
};
|
|
64
71
|
|
|
65
72
|
const styles = StyleSheet.create({
|
|
66
|
-
container: {
|
|
67
|
-
flexDirection: 'row',
|
|
68
|
-
alignItems: 'flex-start',
|
|
69
|
-
backgroundColor: '#FFFFFF',
|
|
70
|
-
paddingHorizontal: 12,
|
|
71
|
-
paddingVertical: 16,
|
|
72
|
-
minHeight: 92,
|
|
73
|
-
width: '100%',
|
|
74
|
-
borderBottomWidth: 1,
|
|
75
|
-
borderBottomColor: '#E2E9FC',
|
|
76
|
-
},
|
|
77
|
-
containerFilled: {
|
|
78
|
-
backgroundColor: '#E2E9FC',
|
|
79
|
-
borderBottomWidth: 0,
|
|
80
|
-
},
|
|
81
73
|
iconContainer: {
|
|
82
74
|
marginRight: 16,
|
|
83
75
|
justifyContent: 'flex-start',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default NavigationButton;
|
|
2
|
-
declare function NavigationButton({ title, description, alertMessage, hideContent, maskedContent, showValueIcon, iconType, iconName, iconSize, iconColor, iconContainerSize, iconContainerRadius, iconContainerColor, titleType, titleColor, descriptionType, descriptionColor, alertIconName, alertIconSize, alertColor, valueIconName, valueIconSize, valueIconColor, showArrow, arrowIconName, arrowIconSize, arrowIconColor, labels, labelTextType, labelTextColor, labelIconSize, labelIconColor, dividerColor, variant, backgroundColor, filledBackgroundColor, borderColor, borderWidth, borderRadius, paddingHorizontal, paddingVertical, minHeight, onPress, style, }: {
|
|
2
|
+
declare function NavigationButton({ title, description, alertMessage, hideContent, maskedContent, showValueIcon, iconType, iconName, iconSize, iconColor, iconContainerSize, iconContainerRadius, iconContainerColor, titleType, titleColor, titleLineHeight, descriptionType, descriptionColor, descriptionLineHeight, alertIconName, alertIconSize, alertColor, valueIconName, valueIconSize, valueIconColor, showArrow, arrowIconName, arrowIconSize, arrowIconColor, labels, labelTextType, labelTextColor, labelIconSize, labelIconColor, dividerColor, variant, backgroundColor, filledBackgroundColor, borderColor, borderWidth, borderRadius, paddingHorizontal, paddingVertical, minHeight, onPress, style, }: {
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
description?: string | undefined;
|
|
5
5
|
alertMessage?: null | undefined;
|
|
@@ -15,8 +15,10 @@ declare function NavigationButton({ title, description, alertMessage, hideConten
|
|
|
15
15
|
iconContainerColor?: string | undefined;
|
|
16
16
|
titleType?: string | undefined;
|
|
17
17
|
titleColor?: string | undefined;
|
|
18
|
+
titleLineHeight?: number | undefined;
|
|
18
19
|
descriptionType?: string | undefined;
|
|
19
20
|
descriptionColor?: string | undefined;
|
|
21
|
+
descriptionLineHeight?: number | undefined;
|
|
20
22
|
alertIconName?: string | undefined;
|
|
21
23
|
alertIconSize?: number | undefined;
|
|
22
24
|
alertColor?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/NavigationButton/index.jsx"],"names":[],"mappings":";AAMA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/NavigationButton/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAuRC;kBA7RiB,OAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, Pressable } from 'react-native';
|
|
3
3
|
import SEText from '../../SEText';
|
|
4
4
|
import Icon from '../../Icon';
|
|
5
5
|
import SEIcon from '../../SEIcon';
|
|
@@ -9,9 +9,9 @@ title = "Tool's Name", description = 'Lorem ipsum dolor sit amet, consectetur ad
|
|
|
9
9
|
// Ícone principal
|
|
10
10
|
iconType = null, iconName = 'image-line', iconSize = 16, iconColor = '#3B5BDB', iconContainerSize = 32, iconContainerRadius = 6, iconContainerColor = '#E6ECFF',
|
|
11
11
|
// Título
|
|
12
|
-
titleType = 'ns-sm-body-bold', titleColor = '#1B244B',
|
|
12
|
+
titleType = 'ns-sm-body-bold', titleColor = '#1B244B', titleLineHeight = 20,
|
|
13
13
|
// Descrição
|
|
14
|
-
descriptionType = 'ns-
|
|
14
|
+
descriptionType = 'ns-xxs-body', descriptionColor = '#485274', descriptionLineHeight = 18,
|
|
15
15
|
// Alerta
|
|
16
16
|
alertIconName = 'alert-line', alertIconSize = 16, alertColor = '#E53935',
|
|
17
17
|
// Valor com ícone
|
|
@@ -19,22 +19,23 @@ valueIconName = 'eye-line', valueIconSize = 16, valueIconColor = '#485274',
|
|
|
19
19
|
// Seta
|
|
20
20
|
showArrow = true, arrowIconName = 'arrow-right-line', arrowIconSize = 20, arrowIconColor = '#1B244B',
|
|
21
21
|
// Labels
|
|
22
|
-
labels = [], labelTextType = 'ns-
|
|
22
|
+
labels = [], labelTextType = 'ns-sm-body-semibold', labelTextColor = '#2A4FDA', labelIconSize = 16, labelIconColor = '#2A4FDA',
|
|
23
23
|
// Dividers
|
|
24
24
|
dividerColor = '#E2E9FC',
|
|
25
25
|
// Container
|
|
26
26
|
variant = 'default', backgroundColor = '#FFFFFF', filledBackgroundColor = '#E2E9FC', borderColor = '#E2E9FC', borderWidth = 1.5, borderRadius = 8, paddingHorizontal = 12, paddingVertical = 16, minHeight = 92,
|
|
27
27
|
// Outros
|
|
28
28
|
onPress, style, }) => {
|
|
29
|
-
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
|
|
29
|
+
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon, onPress }
|
|
30
30
|
const normalizeLabel = (label) => {
|
|
31
31
|
if (typeof label === 'string') {
|
|
32
|
-
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
|
|
32
|
+
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line', onPress: null };
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
text: label.text || 'Label',
|
|
36
36
|
leftIcon: label.leftIcon,
|
|
37
37
|
rightIcon: label.rightIcon,
|
|
38
|
+
onPress: label.onPress || null,
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
@@ -66,7 +67,7 @@ onPress, style, }) => {
|
|
|
66
67
|
</SEText>
|
|
67
68
|
</View>);
|
|
68
69
|
}
|
|
69
|
-
return (<SEText type={descriptionType} color={descriptionColor} style={styles.description}>
|
|
70
|
+
return (<SEText type={descriptionType} color={descriptionColor} style={[styles.description, { lineHeight: descriptionLineHeight }]}>
|
|
70
71
|
{description}
|
|
71
72
|
</SEText>);
|
|
72
73
|
};
|
|
@@ -75,27 +76,36 @@ onPress, style, }) => {
|
|
|
75
76
|
return null;
|
|
76
77
|
const labelsDividerStyle = {
|
|
77
78
|
height: 1,
|
|
78
|
-
backgroundColor:
|
|
79
|
-
marginTop:
|
|
79
|
+
backgroundColor: '#E2E9FC',
|
|
80
|
+
marginTop: 24,
|
|
80
81
|
marginLeft: -(iconContainerSize + 16),
|
|
81
|
-
marginRight: -
|
|
82
|
+
marginRight: -(8 + arrowIconSize + 15),
|
|
82
83
|
};
|
|
83
84
|
const labelsContainerStyle = {
|
|
84
85
|
flexDirection: 'row',
|
|
85
86
|
marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
|
|
86
|
-
marginRight: -(paddingHorizontal +
|
|
87
|
+
marginRight: -(paddingHorizontal + 8 + arrowIconSize + 15),
|
|
87
88
|
marginBottom: -paddingVertical,
|
|
88
|
-
paddingBottom: 12,
|
|
89
89
|
backgroundColor: '#FFFFFF',
|
|
90
|
-
borderBottomLeftRadius: borderRadius,
|
|
91
|
-
borderBottomRightRadius: borderRadius,
|
|
90
|
+
borderBottomLeftRadius: borderRadius - 1,
|
|
91
|
+
borderBottomRightRadius: borderRadius - 1,
|
|
92
|
+
overflow: 'hidden',
|
|
92
93
|
};
|
|
93
94
|
const labelVerticalDividerStyle = {
|
|
94
95
|
width: 1,
|
|
95
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: '#E2E9FC',
|
|
96
97
|
marginTop: 8,
|
|
97
98
|
marginBottom: 0,
|
|
98
99
|
};
|
|
100
|
+
const getLabelButtonStyle = (pressed) => ({
|
|
101
|
+
flex: 1,
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
justifyContent: 'center',
|
|
105
|
+
paddingTop: 16,
|
|
106
|
+
paddingBottom: 12,
|
|
107
|
+
backgroundColor: pressed ? '#F5F7FA' : 'transparent',
|
|
108
|
+
});
|
|
99
109
|
return (<>
|
|
100
110
|
<View style={labelsDividerStyle}/>
|
|
101
111
|
<View style={labelsContainerStyle}>
|
|
@@ -103,30 +113,30 @@ onPress, style, }) => {
|
|
|
103
113
|
const normalizedLabel = normalizeLabel(label);
|
|
104
114
|
return (<React.Fragment key={index}>
|
|
105
115
|
{index > 0 && <View style={labelVerticalDividerStyle}/>}
|
|
106
|
-
<
|
|
116
|
+
<Pressable style={({ pressed }) => getLabelButtonStyle(pressed)} onPress={normalizedLabel.onPress}>
|
|
107
117
|
{normalizedLabel.leftIcon && (<Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor}/>)}
|
|
108
118
|
<SEText type={labelTextType} color={labelTextColor} style={styles.labelText}>
|
|
109
119
|
{normalizedLabel.text}
|
|
110
120
|
</SEText>
|
|
111
|
-
{normalizedLabel.rightIcon && (<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft:
|
|
112
|
-
</
|
|
121
|
+
{normalizedLabel.rightIcon && (<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 8 }}/>)}
|
|
122
|
+
</Pressable>
|
|
113
123
|
</React.Fragment>);
|
|
114
124
|
})}
|
|
115
125
|
</View>
|
|
116
126
|
</>);
|
|
117
127
|
};
|
|
118
|
-
const
|
|
128
|
+
const getContainerStyle = (pressed) => ({
|
|
119
129
|
flexDirection: 'row',
|
|
120
130
|
alignItems: 'flex-start',
|
|
121
|
-
backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
|
|
131
|
+
backgroundColor: variant === 'filled' || pressed ? filledBackgroundColor : backgroundColor,
|
|
122
132
|
paddingHorizontal,
|
|
123
133
|
paddingVertical,
|
|
124
134
|
minHeight,
|
|
125
135
|
width: '100%',
|
|
126
|
-
borderWidth
|
|
136
|
+
borderWidth,
|
|
127
137
|
borderColor,
|
|
128
138
|
borderRadius,
|
|
129
|
-
};
|
|
139
|
+
});
|
|
130
140
|
const iconContainerStyle = {
|
|
131
141
|
marginRight: 16,
|
|
132
142
|
justifyContent: 'flex-start',
|
|
@@ -142,7 +152,7 @@ onPress, style, }) => {
|
|
|
142
152
|
justifyContent: 'center',
|
|
143
153
|
alignItems: 'center',
|
|
144
154
|
};
|
|
145
|
-
return (<
|
|
155
|
+
return (<Pressable style={({ pressed }) => [getContainerStyle(pressed), style]} onPress={onPress}>
|
|
146
156
|
<View style={iconContainerStyle}>
|
|
147
157
|
{isCustomIcon ? (<SEIcon type={iconType} size={iconContainerSize}/>) : (<View style={iconPlaceholderStyle}>
|
|
148
158
|
<Icon name={iconName} size={iconSize} color={iconColor}/>
|
|
@@ -150,7 +160,7 @@ onPress, style, }) => {
|
|
|
150
160
|
</View>
|
|
151
161
|
|
|
152
162
|
<View style={styles.contentContainer}>
|
|
153
|
-
<SEText type={titleType} color={titleColor} style={styles.title}>
|
|
163
|
+
<SEText type={titleType} color={titleColor} style={[styles.title, { lineHeight: titleLineHeight }]}>
|
|
154
164
|
{title}
|
|
155
165
|
</SEText>
|
|
156
166
|
{renderDescription()}
|
|
@@ -160,7 +170,7 @@ onPress, style, }) => {
|
|
|
160
170
|
{showArrow && (<View style={styles.arrowContainer}>
|
|
161
171
|
<Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor}/>
|
|
162
172
|
</View>)}
|
|
163
|
-
</
|
|
173
|
+
</Pressable>);
|
|
164
174
|
};
|
|
165
175
|
const styles = StyleSheet.create({
|
|
166
176
|
contentContainer: {
|
|
@@ -168,7 +178,7 @@ const styles = StyleSheet.create({
|
|
|
168
178
|
justifyContent: 'flex-start',
|
|
169
179
|
},
|
|
170
180
|
title: {
|
|
171
|
-
marginBottom:
|
|
181
|
+
marginBottom: 8,
|
|
172
182
|
},
|
|
173
183
|
description: {
|
|
174
184
|
lineHeight: 20,
|
|
@@ -187,22 +197,16 @@ const styles = StyleSheet.create({
|
|
|
187
197
|
valueText: {
|
|
188
198
|
marginLeft: 4,
|
|
189
199
|
},
|
|
190
|
-
labelButton: {
|
|
191
|
-
flex: 1,
|
|
192
|
-
flexDirection: 'row',
|
|
193
|
-
alignItems: 'center',
|
|
194
|
-
justifyContent: 'center',
|
|
195
|
-
paddingTop: 16,
|
|
196
|
-
paddingBottom: 4,
|
|
197
|
-
},
|
|
198
200
|
labelText: {
|
|
199
|
-
marginLeft:
|
|
201
|
+
marginLeft: 8,
|
|
200
202
|
},
|
|
201
203
|
arrowContainer: {
|
|
202
|
-
marginLeft:
|
|
204
|
+
marginLeft: 8,
|
|
205
|
+
marginRight: 15,
|
|
203
206
|
justifyContent: 'flex-start',
|
|
204
207
|
alignItems: 'center',
|
|
205
208
|
paddingTop: 2,
|
|
209
|
+
flexShrink: 0,
|
|
206
210
|
},
|
|
207
211
|
});
|
|
208
212
|
export default NavigationButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/SearchResult/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/SearchResult/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;sBA+DC;kBArEiB,OAAO"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, Pressable } from 'react-native';
|
|
3
3
|
import SEText from '../../SEText';
|
|
4
4
|
import Icon from '../../Icon';
|
|
5
5
|
import SEIcon from '../../SEIcon';
|
|
6
6
|
const SearchResult = ({ title = 'Title', description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit.', iconType = null, iconName = 'image-line', variant = 'default', onPress, style, showArrow = true, }) => {
|
|
7
7
|
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const getContainerStyle = (pressed) => ({
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
alignItems: 'flex-start',
|
|
11
|
+
backgroundColor: variant === 'filled' || pressed ? '#E2E9FC' : '#FFFFFF',
|
|
12
|
+
paddingHorizontal: 12,
|
|
13
|
+
paddingVertical: 16,
|
|
14
|
+
minHeight: 92,
|
|
15
|
+
width: '100%',
|
|
16
|
+
borderBottomWidth: variant === 'filled' ? 0 : 1,
|
|
17
|
+
borderBottomColor: '#E2E9FC',
|
|
18
|
+
});
|
|
19
|
+
return (<Pressable style={({ pressed }) => [getContainerStyle(pressed), style]} onPress={onPress}>
|
|
13
20
|
<View style={styles.iconContainer}>
|
|
14
21
|
{isCustomIcon ? (<SEIcon type={iconType} size={60}/>) : (<View style={styles.iconPlaceholder}>
|
|
15
22
|
<Icon name={iconName} size={24} color="#3B5BDB"/>
|
|
@@ -28,24 +35,9 @@ const SearchResult = ({ title = 'Title', description = 'Lorem ipsum dolor sit am
|
|
|
28
35
|
{showArrow && (<View style={styles.arrowContainer}>
|
|
29
36
|
<Icon name="arrow-right-line" size={20} color="#1B244B"/>
|
|
30
37
|
</View>)}
|
|
31
|
-
</
|
|
38
|
+
</Pressable>);
|
|
32
39
|
};
|
|
33
40
|
const styles = StyleSheet.create({
|
|
34
|
-
container: {
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
alignItems: 'flex-start',
|
|
37
|
-
backgroundColor: '#FFFFFF',
|
|
38
|
-
paddingHorizontal: 12,
|
|
39
|
-
paddingVertical: 16,
|
|
40
|
-
minHeight: 92,
|
|
41
|
-
width: '100%',
|
|
42
|
-
borderBottomWidth: 1,
|
|
43
|
-
borderBottomColor: '#E2E9FC',
|
|
44
|
-
},
|
|
45
|
-
containerFilled: {
|
|
46
|
-
backgroundColor: '#E2E9FC',
|
|
47
|
-
borderBottomWidth: 0,
|
|
48
|
-
},
|
|
49
41
|
iconContainer: {
|
|
50
42
|
marginRight: 16,
|
|
51
43
|
justifyContent: 'flex-start',
|