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