@nuskin/routine-feature 1.0.1 → 2.0.1

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.
@@ -0,0 +1,363 @@
1
+ import React from 'react';
2
+ import {
3
+ SafeAreaView,
4
+ View,
5
+ StyleSheet,
6
+ ScrollView,
7
+ Text,
8
+ Image,
9
+ ImageBackground,
10
+ Pressable,
11
+ } from 'react-native';
12
+ import { VeraHeader, Logo, HeaderCart, colors } from '@ns/mobile-ui';
13
+ import LinearGradient from 'react-native-linear-gradient';
14
+ import { accessibility } from './helpers/Accessibility';
15
+
16
+ function RoutineDetails(props) {
17
+ const item = props.route?.params;
18
+ return (
19
+ <SafeAreaView style={styles.container} testID="routineStack">
20
+ <VeraHeader
21
+ left={<Logo accessibilityLabel="logo" />}
22
+ right={<HeaderCart accessibilityLabel="crt-btn" />}
23
+ title={item.reference}
24
+ {...accessibility(`vera-header`)}
25
+ />
26
+ <ScrollView style={styles.routinesContainer}>
27
+ {item && (
28
+ <>
29
+ <View style={{ position: 'relative' }}>
30
+ <ImageBackground
31
+ {...accessibility(`image-routine-background`)}
32
+ source={{
33
+ uri: item.routine_imageConnection?.edges[0]?.node?.url,
34
+ }}
35
+ style={styles.itemPhoto}
36
+ >
37
+ <LinearGradient
38
+ colors={['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0.6)']}
39
+ locations={[0.6, 1]}
40
+ style={styles.imageOverlay}
41
+ />
42
+ <View style={styles.itemTitleContainer}>
43
+ <Text style={styles.itemTextSpan}>
44
+ {item.routine_subtitle}
45
+ </Text>
46
+ <Text style={styles.itemTextTitle}>{item.routine_title}</Text>
47
+ </View>
48
+ </ImageBackground>
49
+ </View>
50
+ <View style={styles.routineDetailsContainer}>
51
+ <View style={styles.routineDetails}>
52
+ <Text style={styles.itemTextDescription}>
53
+ {item.routines_description}
54
+ </Text>
55
+ <Text style={styles.itemText}>{item.products_used_label}</Text>
56
+ {item.products.map((item, index) => {
57
+ return (
58
+ <View key={index} style={{ flexDirection: 'row' }}>
59
+ <Image
60
+ key={index}
61
+ source={{
62
+ uri: item.product_imageConnection?.edges[0]?.node
63
+ ?.url,
64
+ }}
65
+ style={styles.productPhoto}
66
+ resizeMode="contain"
67
+ />
68
+ <View style={styles.productName}>
69
+ <Text style={styles.itemTextProduct}>
70
+ {item.product_category}
71
+ </Text>
72
+ <Text style={styles.itemTextProduct}>
73
+ {item.product_name}
74
+ </Text>
75
+ </View>
76
+ </View>
77
+ );
78
+ })}
79
+ </View>
80
+ </View>
81
+ {item.steps.map((item, index) => {
82
+ return (
83
+ <View
84
+ key={index}
85
+ style={{
86
+ marginHorizontal: 20,
87
+ marginBottom: 15,
88
+ }}
89
+ >
90
+ <View
91
+ style={{
92
+ flexDirection: 'row',
93
+ marginVertical: 10,
94
+ }}
95
+ >
96
+ <Text style={styles.itemTextTitleIndex}>{index + 1}</Text>
97
+ <Text style={styles.itemTextStepTitle}>
98
+ {item.step_title}
99
+ </Text>
100
+ </View>
101
+ <View
102
+ style={styles[`${item.style ? item.style : 'Container'}`]}
103
+ >
104
+ {(item.style === 'Image' || item.style == 'LumiSpaIO') && (
105
+ <Image
106
+ source={{
107
+ uri: item.imageConnection?.edges[0]?.node?.url,
108
+ }}
109
+ style={styles.stepImagePhoto}
110
+ resizeMode="contain"
111
+ />
112
+ )}
113
+ <View
114
+ style={
115
+ styles[
116
+ `${
117
+ item.style
118
+ ? `${item.style}TextContainer`
119
+ : 'TextContainer'
120
+ }`
121
+ ]
122
+ }
123
+ >
124
+ <Text style={styles.itemTextStepDescription}>
125
+ {item.step_description}
126
+ </Text>
127
+ <Text style={styles.itemTextStepSubDescription}>
128
+ {item.step_sub_description}
129
+ </Text>
130
+ {item.style === 'LumiSpaIO' && (
131
+ <Pressable style={styles.textLumiSpaTreatmentContainer}>
132
+ <Text style={styles.textLumiSpaTreatment}>
133
+ {item.image_title}
134
+ </Text>
135
+ </Pressable>
136
+ )}
137
+ </View>
138
+ </View>
139
+ {item.style === 'Product' && (
140
+ <View style={styles.stepProductContainer}>
141
+ <Image
142
+ source={{
143
+ uri: item.imageConnection?.edges[0]?.node?.url,
144
+ }}
145
+ style={styles.stepProductPhoto}
146
+ resizeMode="contain"
147
+ />
148
+ <View style={styles.productName}>
149
+ <Text style={styles.itemTextStepProduct}>
150
+ {item.image_title}
151
+ </Text>
152
+ <Text style={styles.itemTextStepProduct}>
153
+ {item.image_description}
154
+ </Text>
155
+ </View>
156
+ </View>
157
+ )}
158
+ </View>
159
+ );
160
+ })}
161
+ </>
162
+ )}
163
+ </ScrollView>
164
+ </SafeAreaView>
165
+ );
166
+ }
167
+ const styles = StyleSheet.create({
168
+ container: {
169
+ flex: 1,
170
+ backgroundColor: colors.white,
171
+ },
172
+ routinesContainer: {
173
+ backgroundColor: colors.primaryGray,
174
+ flex: 1,
175
+ },
176
+ sectionHeader: {
177
+ textTransform: 'uppercase',
178
+ fontWeight: '600',
179
+ fontSize: 14,
180
+ // color: '#f4f4f4',
181
+ marginTop: 20,
182
+ paddingHorizontal: 15,
183
+ marginBottom: 5,
184
+ },
185
+ imageOverlay: {
186
+ position: 'absolute',
187
+ left: 0,
188
+ right: 0,
189
+ top: 0,
190
+ height: '100%',
191
+ },
192
+ item: {
193
+ margin: 10,
194
+ borderRadius: 14,
195
+ },
196
+ itemPhoto: {
197
+ width: '100%',
198
+ minHeight: 160,
199
+ aspectRatio: 1.5,
200
+ },
201
+ Image: {
202
+ flexDirection: 'row',
203
+ flex: 1,
204
+ backgroundColor: colors.white,
205
+ },
206
+ ImageTextContainer: {
207
+ flex: 1,
208
+ padding: 20,
209
+ },
210
+ LumiSpaIOTextContainer: {
211
+ flex: 1,
212
+ padding: 20,
213
+ },
214
+ Container: {
215
+ flexDirection: 'column',
216
+ flex: 1,
217
+ padding: 20,
218
+ backgroundColor: colors.white,
219
+ },
220
+ Product: {
221
+ flexDirection: 'column',
222
+ flex: 1,
223
+ padding: 20,
224
+ backgroundColor: colors.white,
225
+ },
226
+ LumiSpaIO: {
227
+ flexDirection: 'row',
228
+ flex: 1,
229
+ backgroundColor: colors.white,
230
+ },
231
+ productName: {
232
+ flex: 1,
233
+ justifyContent: 'center',
234
+ marginLeft: 5,
235
+ },
236
+ routineDetailsContainer: {
237
+ backgroundColor: 'white',
238
+ paddingTop: 20,
239
+ paddingBottom: 10,
240
+ marginBottom: 10,
241
+ },
242
+ routineDetails: {
243
+ flexDirection: 'column',
244
+ paddingHorizontal: 15,
245
+ paddingVertical: 10,
246
+ },
247
+ stepImagePhoto: {
248
+ width: 130,
249
+ minHeight: 150,
250
+ },
251
+ stepProductPhoto: {
252
+ width: 80,
253
+ height: 80,
254
+ },
255
+ stepProductContainer: {
256
+ flexDirection: 'row',
257
+ backgroundColor: colors.white,
258
+ paddingHorizontal: 20,
259
+ paddingBottom: 20,
260
+ },
261
+ productPhoto: {
262
+ margin: 2,
263
+ width: 40,
264
+ height: 40,
265
+ borderRadius: 50,
266
+ borderColor: '#EDEDED',
267
+ borderWidth: 1,
268
+ },
269
+ itemTextStepProduct: {
270
+ fontWeight: '400',
271
+ fontSize: 13,
272
+ lineHeight: 18,
273
+ },
274
+ itemTitleContainer: {
275
+ flexDirection: 'column',
276
+ justifyContent: 'space-between',
277
+ paddingHorizontal: 15,
278
+ position: 'absolute',
279
+ bottom: 20,
280
+ },
281
+ itemTextSpan: {
282
+ color: colors.white,
283
+ fontWeight: '400',
284
+ fontSize: 14,
285
+ textTransform: 'uppercase',
286
+ },
287
+ itemTextTitleIndex: {
288
+ color: colors.accentB400,
289
+ fontWeight: '400',
290
+ fontSize: 20,
291
+ lineHeight: 26,
292
+ paddingRight: 10,
293
+ },
294
+ itemTextStepTitle: {
295
+ color: colors.primaryBlack,
296
+ fontWeight: '600',
297
+ fontSize: 18,
298
+ lineHeight: 26,
299
+ },
300
+ itemTextStepSubDescription: {
301
+ fontWeight: '700',
302
+ fontSize: 10,
303
+ lineHeight: 15,
304
+ letterSpacing: 0.5,
305
+ paddingTop: 5,
306
+ textTransform: 'uppercase',
307
+ },
308
+ itemTextTitle: {
309
+ color: colors.white,
310
+ fontWeight: '400',
311
+ fontSize: 26,
312
+ },
313
+ itemTextDescription: {
314
+ color: colors.primaryBlack,
315
+ fontWeight: '400',
316
+ fontSize: 14,
317
+ lineHeight: 20,
318
+ paddingBottom: 20,
319
+ },
320
+ itemText: {
321
+ color: colors.primaryBlack,
322
+ fontWeight: 'bold',
323
+ fontSize: 12,
324
+ letterSpacing: 0.05,
325
+ paddingBottom: 5,
326
+ textTransform: 'uppercase',
327
+ },
328
+ itemTextStepDescription: {
329
+ color: colors.primaryBlack,
330
+ fontWeight: 'bold',
331
+ fontSize: 12,
332
+ letterSpacing: 0.05,
333
+ paddingBottom: 5,
334
+ },
335
+ itemTextProduct: {
336
+ color: colors.primaryBlack,
337
+ fontSize: 11,
338
+ fontWeight: '600',
339
+ textTransform: 'uppercase',
340
+ letterSpacing: 0.05,
341
+ },
342
+ itemTextSteps: {
343
+ color: colors.primaryBlack,
344
+ fontWeight: 'bold',
345
+ textTransform: 'uppercase',
346
+ },
347
+ textLumiSpaTreatmentContainer: {
348
+ marginTop: 10,
349
+ padding: 10,
350
+ textAlign: 'center',
351
+ borderStyle: 'solid',
352
+ borderWidth: 1,
353
+ borderColor: colors.primaryBlack,
354
+ },
355
+ textLumiSpaTreatment: {
356
+ textAlign: 'center',
357
+ fontSize: 14,
358
+ fontWeight: '600',
359
+ lineHeight: 16,
360
+ letterSpacing: 0.05,
361
+ },
362
+ });
363
+ export default RoutineDetails;
@@ -0,0 +1,7 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ export function accessibility(id?: string) {
4
+ return Platform.OS === 'android'
5
+ ? { accessible: true, accessibilityLabel: id }
6
+ : { accessible: false, testID: id };
7
+ }