decathlon-ui 0.3.14 → 0.3.15
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 +1 -1
- package/dist/components/product-card/product-card.styles.js +2 -2
- 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;AAQ/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;AAQ/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAoJ7D,eAAO,MAAM,WAAW,8CAAmC,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { HeartFillIcon, HeartIcon, StarIcon } from "../../icons";
|
|
|
5
5
|
import { Badge } from "../badge";
|
|
6
6
|
import { Loading } from "../loading";
|
|
7
7
|
import { useProductCardStyles } from "./product-card.styles";
|
|
8
|
-
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [],
|
|
8
|
+
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [], showRating = true, isLoadingFavorite = false, }) => {
|
|
9
9
|
const styles = useProductCardStyles(variant, width);
|
|
10
10
|
const handleFavoritePress = React.useCallback((e) => {
|
|
11
11
|
e.stopPropagation();
|
|
@@ -13,7 +13,7 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
13
13
|
}, [onFavoritePress]);
|
|
14
14
|
const renderContent = React.useCallback(() => (_jsxs(View, { style: styles.cardContainer, children: [_jsxs(View, { style: styles.imageContainer, children: [_jsx(Image, { resizeMode: "cover", source: { uri: imageUrl }, style: styles.productImage, accessibilityLabel: `Imagem do produto ${productName}` }), ["grid", "shelf"].includes(variant) &&
|
|
15
15
|
(flags === null || flags === void 0 ? void 0 : flags.length) > 0 &&
|
|
16
|
-
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, style: { position: "absolute", top: 0, left: 0 }, icon: flag.icon }, flag.name + index + productName)))),
|
|
16
|
+
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, style: { position: "absolute", top: 0, left: 0 }, icon: flag.icon }, flag.name + index + productName)))), isFavorite && (_jsx(TouchableOpacity, { style: [
|
|
17
17
|
isFavorite ? styles.favoriteButton : styles.unfavoriteButton,
|
|
18
18
|
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: isLoadingFavorite ? (_jsx(Loading, { size: 20 })) : isFavorite ? (_jsx(HeartFillIcon, { size: 20, color: "#101010" })) : (_jsx(HeartIcon, { size: 20, color: "#101010" })) }))] }), variant !== "lastViewed" && (_jsxs(View, { style: styles.detailsContainer, children: [_jsxs(View, { style: styles.productInfo, children: [_jsx(Text, { style: styles.brandText, children: brand }), _jsx(View, { style: styles.nameContainer, children: _jsx(Text, { numberOfLines: 3, style: styles.nameText, accessibilityLabel: `Nome do produto: ${productName}`, children: productName }) })] }), variant === "grid" && showRating && (_jsxs(View, { style: styles.ratingContainer, accessibilityLabel: `Avaliação: ${rating} estrelas, ${reviewCount} avaliações`, children: [_jsx(StarIcon, { size: 11, color: "#101010", fill: "#101010" }), _jsxs(View, { style: styles.reviewCountWrapper, children: [_jsx(Text, { style: styles.ratingText, children: rating }), _jsxs(Text, { style: styles.reviewCountText, children: ["(", reviewCount, ")"] })] })] })), _jsx(View, { style: styles.priceContainer, children: _jsx(Text, { style: styles.priceText, accessibilityLabel: `Preço: ${price}`, children: price }) })] }))] })), [
|
|
19
19
|
brand,
|
|
@@ -2,7 +2,7 @@ import type { ProductCardVariant } from "./product-card.types";
|
|
|
2
2
|
export declare const useProductCardStyles: (variant?: ProductCardVariant, customWidth?: number) => {
|
|
3
3
|
cardContainer: {
|
|
4
4
|
display: "flex";
|
|
5
|
-
width:
|
|
5
|
+
width: "100%";
|
|
6
6
|
maxWidth: number;
|
|
7
7
|
flexDirection: "column";
|
|
8
8
|
alignItems: "stretch";
|
|
@@ -19,8 +19,8 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
19
19
|
return StyleSheet.create({
|
|
20
20
|
cardContainer: {
|
|
21
21
|
display: "flex",
|
|
22
|
-
width:
|
|
23
|
-
maxWidth:
|
|
22
|
+
width: "100%",
|
|
23
|
+
maxWidth: 184,
|
|
24
24
|
flexDirection: "column",
|
|
25
25
|
alignItems: "stretch",
|
|
26
26
|
},
|