related-ui-components 2.0.1 → 2.0.3
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/lib/module/app.js +31 -147
- package/lib/module/app.js.map +1 -1
- package/lib/module/components/Card/index.js +1 -0
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Card/templates/DealCardWithBackgroundImage.js +1 -1
- package/lib/module/components/Card/templates/DealCardWithBackgroundImage.js.map +1 -1
- package/lib/module/components/Card/templates/SelaDealCard.js +52 -90
- package/lib/module/components/Card/templates/SelaDealCard.js.map +1 -1
- package/lib/module/components/LockOverlay/LockOverlay.js +84 -33
- package/lib/module/components/LockOverlay/LockOverlay.js.map +1 -1
- package/lib/typescript/src/app.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/index.d.ts +1 -0
- package/lib/typescript/src/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/templates/SelaDealCard.d.ts +3 -0
- package/lib/typescript/src/components/Card/templates/SelaDealCard.d.ts.map +1 -1
- package/lib/typescript/src/components/LockOverlay/LockOverlay.d.ts +10 -7
- package/lib/typescript/src/components/LockOverlay/LockOverlay.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/app.tsx +22 -119
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/templates/DealCardWithBackgroundImage.tsx +1 -1
- package/src/components/Card/templates/SelaDealCard.tsx +239 -259
- package/src/components/LockOverlay/LockOverlay.tsx +86 -35
|
@@ -1,286 +1,266 @@
|
|
|
1
1
|
// src/components/SelaDealCard/SelaDealCard.tsx
|
|
2
2
|
import React from "react";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
ImageSourcePropType,
|
|
5
|
+
StyleProp,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
View,
|
|
8
|
+
Text,
|
|
9
|
+
TextStyle,
|
|
10
|
+
DimensionValue,
|
|
11
|
+
StyleSheet,
|
|
12
12
|
} from "react-native";
|
|
13
13
|
import Card from "../Card"; // Adjust path to your Card component
|
|
14
14
|
import { useTheme } from "../../../theme/ThemeContext"; // Adjust path
|
|
15
|
+
import { ThemeType } from "../../../theme";
|
|
16
|
+
import { LockOverlay } from "../../LockOverlay";
|
|
15
17
|
|
|
16
18
|
interface SelaDealCardProps {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
variant: "horizontal" | "vertical";
|
|
20
|
+
backgroundImage: ImageSourcePropType;
|
|
21
|
+
label?: string;
|
|
22
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
23
|
+
labelContainerStyle?: StyleProp<ViewStyle>;
|
|
24
|
+
providerName?: string;
|
|
25
|
+
providerNameStyle?: StyleProp<TextStyle>;
|
|
26
|
+
description?: string;
|
|
27
|
+
descriptionStyle?: StyleProp<TextStyle>;
|
|
28
|
+
price?: string;
|
|
29
|
+
priceStyle?: StyleProp<TextStyle>;
|
|
30
|
+
priceContainerStyle?: StyleProp<ViewStyle>;
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
style?: StyleProp<ViewStyle>; // Overall card style
|
|
33
|
+
width?: DimensionValue;
|
|
34
|
+
height?: DimensionValue;
|
|
35
|
+
isRTL?: boolean;
|
|
36
|
+
borderRadius?: number;
|
|
37
|
+
contentColor?: string; // For text like providerName, description on the image
|
|
38
|
+
labelBackgroundColor?: string;
|
|
39
|
+
labelTextColor?: string;
|
|
40
|
+
priceBackgroundColor?: string;
|
|
41
|
+
priceTextColor?: string;
|
|
42
|
+
darkOverlayEnabled?: boolean; // New prop
|
|
43
|
+
darkOverlayColor?: string; // New prop for custom overlay color
|
|
44
|
+
lockOverlay?: boolean
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
const SelaDealCard: React.FC<SelaDealCardProps> = ({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
priceBackgroundColor,
|
|
65
|
-
priceTextColor,
|
|
48
|
+
variant,
|
|
49
|
+
backgroundImage,
|
|
50
|
+
label,
|
|
51
|
+
labelStyle,
|
|
52
|
+
labelContainerStyle,
|
|
53
|
+
providerName,
|
|
54
|
+
providerNameStyle,
|
|
55
|
+
description,
|
|
56
|
+
descriptionStyle,
|
|
57
|
+
price,
|
|
58
|
+
priceStyle,
|
|
59
|
+
priceContainerStyle,
|
|
60
|
+
onPress,
|
|
61
|
+
style,
|
|
62
|
+
width = "100%",
|
|
63
|
+
height = variant === "horizontal" ? 180 : 280, // Different default heights
|
|
64
|
+
isRTL: propIsRTL,
|
|
65
|
+
borderRadius = 12, // Default based on images
|
|
66
|
+
darkOverlayEnabled = true,
|
|
67
|
+
darkOverlayColor = "rgba(0, 0, 0, 0.3)",
|
|
68
|
+
lockOverlay = false
|
|
66
69
|
}) => {
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
const { theme, isRTL: themeIsRTL } = useTheme();
|
|
71
|
+
const isRTL = propIsRTL !== undefined ? propIsRTL : themeIsRTL;
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
// Provider name in images is often yellow, description white.
|
|
72
|
-
// Consumers can override with providerNameStyle/descriptionStyle.
|
|
73
|
-
const mainImageTextColor = contentColor || "#FFFFFF"; // Default to white
|
|
73
|
+
const styles = getStyles(theme, isRTL);
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const finalLabelContainerStyle: StyleProp<ViewStyle> = [
|
|
76
|
+
styles.labelContainerBase,
|
|
77
|
+
labelContainerStyle,
|
|
78
|
+
];
|
|
79
|
+
const finalLabelStyle: StyleProp<TextStyle> = [
|
|
80
|
+
styles.labelTextBase,
|
|
81
|
+
labelStyle,
|
|
82
|
+
];
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
const finalPriceContainerStyle: StyleProp<ViewStyle> = [
|
|
85
|
+
styles.priceContainerBase,
|
|
86
|
+
variant === "horizontal"
|
|
87
|
+
? styles.priceContainerHorizontal
|
|
88
|
+
: styles.priceContainerVertical,
|
|
89
|
+
priceContainerStyle,
|
|
90
|
+
];
|
|
91
|
+
const finalPriceStyle: StyleProp<TextStyle> = [
|
|
92
|
+
styles.priceTextBase,
|
|
93
|
+
priceStyle,
|
|
94
|
+
];
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const defaultVerticalPriceBg =
|
|
99
|
-
priceBackgroundColor || "rgba(0, 0, 0, 0.5)";
|
|
100
|
-
const defaultVerticalPriceText = priceTextColor || "#FFFFFF";
|
|
96
|
+
const providerTextStyle: StyleProp<TextStyle> = [
|
|
97
|
+
styles.providerNameBase,
|
|
98
|
+
{ color: theme.onSurface, textAlign: isRTL ? "right" : "left" },
|
|
99
|
+
providerNameStyle,
|
|
100
|
+
];
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
variant === "horizontal"
|
|
108
|
-
? defaultHorizontalPriceText
|
|
109
|
-
: defaultVerticalPriceText;
|
|
110
|
-
|
|
111
|
-
const finalPriceContainerStyle: StyleProp<ViewStyle> = [
|
|
112
|
-
styles.priceContainerBase,
|
|
113
|
-
{ backgroundColor: actualPriceBgColor },
|
|
114
|
-
variant === "horizontal"
|
|
115
|
-
? styles.priceContainerHorizontal
|
|
116
|
-
: styles.priceContainerVertical,
|
|
117
|
-
priceContainerStyle,
|
|
118
|
-
];
|
|
119
|
-
const finalPriceStyle: StyleProp<TextStyle> = [
|
|
120
|
-
styles.priceTextBase,
|
|
121
|
-
{ color: actualPriceTxtColor },
|
|
122
|
-
priceStyle,
|
|
123
|
-
];
|
|
102
|
+
const descriptionTextStyle: StyleProp<TextStyle> = [
|
|
103
|
+
styles.descriptionBase,
|
|
104
|
+
{ color: theme.onSurface, textAlign: isRTL ? "right" : "left" },
|
|
105
|
+
descriptionStyle,
|
|
106
|
+
];
|
|
124
107
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
108
|
+
return (
|
|
109
|
+
<Card
|
|
110
|
+
onPress={onPress}
|
|
111
|
+
style={[styles.cardBase, { borderRadius, width, height }, style]}
|
|
112
|
+
backgroundImage={{
|
|
113
|
+
source: backgroundImage,
|
|
114
|
+
resizeMode: "cover",
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{darkOverlayEnabled && (
|
|
118
|
+
<View
|
|
119
|
+
style={[
|
|
120
|
+
StyleSheet.absoluteFill,
|
|
121
|
+
{ backgroundColor: darkOverlayColor },
|
|
122
|
+
{ borderRadius: borderRadius }
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
132
126
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
<LockOverlay
|
|
128
|
+
visible={lockOverlay}
|
|
129
|
+
contentPosition={variant == "horizontal" ?
|
|
130
|
+
isRTL ? "top-left" : "top-right" :
|
|
131
|
+
isRTL ? "top-right" : "top-left"
|
|
132
|
+
}
|
|
133
|
+
iconSize={24}
|
|
134
|
+
text={""}
|
|
135
|
+
overlayOpacity={0.4}
|
|
136
|
+
/>
|
|
138
137
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
: isRTL
|
|
162
|
-
? "flex-start"
|
|
163
|
-
: "flex-end",
|
|
164
|
-
},
|
|
165
|
-
]}
|
|
166
|
-
>
|
|
167
|
-
{label && (
|
|
168
|
-
<View style={finalLabelContainerStyle}>
|
|
169
|
-
<Text style={finalLabelStyle}>{label}</Text>
|
|
170
|
-
</View>
|
|
171
|
-
)}
|
|
172
|
-
</View>
|
|
138
|
+
<View style={styles.overlayContainer}>
|
|
139
|
+
<View
|
|
140
|
+
style={[
|
|
141
|
+
styles.topSection,
|
|
142
|
+
{
|
|
143
|
+
alignItems:
|
|
144
|
+
variant === "horizontal"
|
|
145
|
+
? isRTL
|
|
146
|
+
? "flex-end"
|
|
147
|
+
: "flex-start"
|
|
148
|
+
: isRTL
|
|
149
|
+
? "flex-start"
|
|
150
|
+
: "flex-end",
|
|
151
|
+
},
|
|
152
|
+
]}
|
|
153
|
+
>
|
|
154
|
+
{label && (
|
|
155
|
+
<View style={finalLabelContainerStyle}>
|
|
156
|
+
<Text style={finalLabelStyle}>{label}</Text>
|
|
157
|
+
</View>
|
|
158
|
+
)}
|
|
159
|
+
</View>
|
|
173
160
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
161
|
+
{variant === "horizontal" ? (
|
|
162
|
+
<View style={styles.bottomContentHorizontal}>
|
|
163
|
+
<View style={styles.textBlockHorizontal}>
|
|
164
|
+
{providerName && (
|
|
165
|
+
<Text style={providerTextStyle}>{providerName}</Text>
|
|
166
|
+
)}
|
|
167
|
+
{description && (
|
|
168
|
+
<Text style={descriptionTextStyle}>{description}</Text>
|
|
169
|
+
)}
|
|
170
|
+
</View>
|
|
171
|
+
{price && (
|
|
172
|
+
<View style={finalPriceContainerStyle}>
|
|
173
|
+
<Text style={finalPriceStyle}>{price}</Text>
|
|
174
|
+
</View>
|
|
175
|
+
)}
|
|
176
|
+
</View>
|
|
177
|
+
) : (
|
|
178
|
+
<View style={styles.bottomContentVertical}>
|
|
179
|
+
<View style={styles.textBlockVertical}>
|
|
180
|
+
{providerName && (
|
|
181
|
+
<Text style={providerTextStyle}>{providerName}</Text>
|
|
182
|
+
)}
|
|
183
|
+
{description && (
|
|
184
|
+
<Text style={descriptionTextStyle}>{description}</Text>
|
|
185
|
+
)}
|
|
186
|
+
</View>
|
|
187
|
+
{price && (
|
|
188
|
+
<View style={finalPriceContainerStyle}>
|
|
189
|
+
<Text style={finalPriceStyle}>{price}</Text>
|
|
190
|
+
</View>
|
|
191
|
+
)}
|
|
192
|
+
</View>
|
|
193
|
+
)}
|
|
184
194
|
</View>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<Text style={finalPriceStyle}>{price}</Text>
|
|
188
|
-
</View>
|
|
189
|
-
)}
|
|
190
|
-
</View>
|
|
191
|
-
) : (
|
|
192
|
-
// Vertical Variant
|
|
193
|
-
<View style={styles.bottomContentVertical}>
|
|
194
|
-
<View style={styles.textBlockVertical}>
|
|
195
|
-
{providerName && (
|
|
196
|
-
<Text style={providerTextStyle}>{providerName}</Text>
|
|
197
|
-
)}
|
|
198
|
-
{description && (
|
|
199
|
-
<Text style={descriptionTextStyle}>{description}</Text>
|
|
200
|
-
)}
|
|
201
|
-
</View>
|
|
202
|
-
{price && (
|
|
203
|
-
<View style={finalPriceContainerStyle}>
|
|
204
|
-
<Text style={finalPriceStyle}>{price}</Text>
|
|
205
|
-
</View>
|
|
206
|
-
)}
|
|
207
|
-
</View>
|
|
208
|
-
)}
|
|
209
|
-
</View>
|
|
210
|
-
</Card>
|
|
211
|
-
);
|
|
195
|
+
</Card>
|
|
196
|
+
);
|
|
212
197
|
};
|
|
213
198
|
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
priceContainerVertical: {
|
|
281
|
-
alignSelf: "stretch", // Makes the price box take the full width
|
|
282
|
-
alignItems: "center", // Centers the price text within the wide box
|
|
283
|
-
},
|
|
199
|
+
const getStyles = (theme: ThemeType, isRTL: boolean) => StyleSheet.create({
|
|
200
|
+
cardBase: {
|
|
201
|
+
overflow: "hidden",
|
|
202
|
+
position: "relative",
|
|
203
|
+
},
|
|
204
|
+
overlayContainer: {
|
|
205
|
+
flex: 1,
|
|
206
|
+
padding: 16,
|
|
207
|
+
justifyContent: "space-between",
|
|
208
|
+
},
|
|
209
|
+
topSection: {
|
|
210
|
+
},
|
|
211
|
+
labelContainerBase: {
|
|
212
|
+
paddingVertical: 6,
|
|
213
|
+
paddingHorizontal: 12,
|
|
214
|
+
borderRadius: 8,
|
|
215
|
+
backgroundColor: theme.background
|
|
216
|
+
},
|
|
217
|
+
labelTextBase: {
|
|
218
|
+
fontWeight: "600",
|
|
219
|
+
fontSize: 13,
|
|
220
|
+
color: theme.onBackground
|
|
221
|
+
},
|
|
222
|
+
providerNameBase: {
|
|
223
|
+
fontSize: 20,
|
|
224
|
+
fontWeight: "bold",
|
|
225
|
+
marginBottom: 2,
|
|
226
|
+
color: theme.secondary
|
|
227
|
+
},
|
|
228
|
+
descriptionBase: {
|
|
229
|
+
fontSize: 14,
|
|
230
|
+
color: theme.helper
|
|
231
|
+
},
|
|
232
|
+
priceContainerBase: {
|
|
233
|
+
paddingVertical: 8,
|
|
234
|
+
paddingHorizontal: 16,
|
|
235
|
+
borderRadius: 10,
|
|
236
|
+
backgroundColor: theme.primary
|
|
237
|
+
},
|
|
238
|
+
priceTextBase: {
|
|
239
|
+
fontWeight: "bold",
|
|
240
|
+
fontSize: 16,
|
|
241
|
+
color: theme.onPrimary
|
|
242
|
+
},
|
|
243
|
+
bottomContentHorizontal: {
|
|
244
|
+
flexDirection: isRTL ? "row-reverse" : "row",
|
|
245
|
+
justifyContent: "space-between",
|
|
246
|
+
alignItems: "flex-end",
|
|
247
|
+
},
|
|
248
|
+
textBlockHorizontal: {
|
|
249
|
+
flex: 1,
|
|
250
|
+
marginRight: 10,
|
|
251
|
+
},
|
|
252
|
+
priceContainerHorizontal: {
|
|
253
|
+
},
|
|
254
|
+
bottomContentVertical: {
|
|
255
|
+
flexDirection: "column",
|
|
256
|
+
},
|
|
257
|
+
textBlockVertical: {
|
|
258
|
+
marginBottom: 12,
|
|
259
|
+
},
|
|
260
|
+
priceContainerVertical: {
|
|
261
|
+
alignSelf: "stretch",
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
},
|
|
284
264
|
});
|
|
285
265
|
|
|
286
266
|
export default SelaDealCard;
|