decathlon-ui 0.3.4 → 0.3.5
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/dist/components/product-card/product-card.component.d.ts.map +1 -1
- package/dist/components/product-card/product-card.component.js +2 -2
- package/dist/components/product-card/product-card.styles.d.ts +3 -2
- package/dist/components/product-card/product-card.styles.d.ts.map +1 -1
- package/dist/components/product-card/product-card.styles.js +11 -7
- package/dist/components/product-card/product-card.types.d.ts +1 -0
- package/dist/components/product-card/product-card.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAgJ7D,eAAO,MAAM,WAAW,8CAAmC,CAAC"}
|
|
@@ -4,8 +4,8 @@ import { Image, Text, TouchableOpacity, View } from "react-native";
|
|
|
4
4
|
import { HeartIcon, StarIcon } from "../../icons";
|
|
5
5
|
import { Badge } from "../badge";
|
|
6
6
|
import { useProductCardStyles } from "./product-card.styles";
|
|
7
|
-
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, isFavorite = false, onFavoritePress, onPress, testID, flags = [], }) => {
|
|
8
|
-
const styles = useProductCardStyles(variant);
|
|
7
|
+
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [], }) => {
|
|
8
|
+
const styles = useProductCardStyles(variant, width);
|
|
9
9
|
const handleFavoritePress = React.useCallback((e) => {
|
|
10
10
|
e.stopPropagation();
|
|
11
11
|
onFavoritePress === null || onFavoritePress === void 0 ? void 0 : onFavoritePress();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ProductCardVariant } from "./product-card.types";
|
|
2
|
-
export declare const useProductCardStyles: (variant?: ProductCardVariant) => {
|
|
2
|
+
export declare const useProductCardStyles: (variant?: ProductCardVariant, customWidth?: number) => {
|
|
3
3
|
cardContainer: {
|
|
4
4
|
display: "flex";
|
|
5
|
+
width: number;
|
|
5
6
|
maxWidth: number;
|
|
6
7
|
flexDirection: "column";
|
|
7
8
|
alignItems: "stretch";
|
|
@@ -94,7 +95,7 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant) => {
|
|
|
94
95
|
color: string;
|
|
95
96
|
};
|
|
96
97
|
touchable: {
|
|
97
|
-
width:
|
|
98
|
+
width: number;
|
|
98
99
|
maxWidth: number;
|
|
99
100
|
};
|
|
100
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"product-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAO,MAAM,oBAAoB,GAC/B,UAAS,kBAA2B,EACpC,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { StyleSheet } from "react-native";
|
|
3
|
-
export const useProductCardStyles = (variant = "grid") => {
|
|
3
|
+
export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
4
4
|
return useMemo(() => {
|
|
5
5
|
const getImageSize = () => {
|
|
6
6
|
switch (variant) {
|
|
@@ -13,10 +13,14 @@ export const useProductCardStyles = (variant = "grid") => {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
const imageSize = getImageSize();
|
|
16
|
+
const cardWidth = customWidth
|
|
17
|
+
? Math.max(customWidth, imageSize)
|
|
18
|
+
: imageSize;
|
|
16
19
|
return StyleSheet.create({
|
|
17
20
|
cardContainer: {
|
|
18
21
|
display: "flex",
|
|
19
|
-
|
|
22
|
+
width: cardWidth,
|
|
23
|
+
maxWidth: cardWidth,
|
|
20
24
|
flexDirection: "column",
|
|
21
25
|
alignItems: "stretch",
|
|
22
26
|
},
|
|
@@ -33,8 +37,8 @@ export const useProductCardStyles = (variant = "grid") => {
|
|
|
33
37
|
aspectRatio: 1,
|
|
34
38
|
gap: 20,
|
|
35
39
|
justifyContent: "space-between",
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
40
|
+
width: cardWidth,
|
|
41
|
+
height: cardWidth,
|
|
38
42
|
},
|
|
39
43
|
detailsContainer: {
|
|
40
44
|
display: variant === "lastViewed" ? "none" : "flex",
|
|
@@ -108,9 +112,9 @@ export const useProductCardStyles = (variant = "grid") => {
|
|
|
108
112
|
color: "#383838",
|
|
109
113
|
},
|
|
110
114
|
touchable: {
|
|
111
|
-
width:
|
|
112
|
-
maxWidth:
|
|
115
|
+
width: cardWidth,
|
|
116
|
+
maxWidth: cardWidth,
|
|
113
117
|
},
|
|
114
118
|
});
|
|
115
|
-
}, [variant]);
|
|
119
|
+
}, [variant, customWidth]);
|
|
116
120
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;CACL"}
|
|
1
|
+
{"version":3,"file":"product-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;CACL"}
|