decathlon-ui 0.3.3 → 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/button/button.component.d.ts.map +1 -1
- package/dist/components/button/button.component.js +1 -3
- package/dist/components/button/button.props.d.ts +3 -2
- package/dist/components/button/button.props.d.ts.map +1 -1
- package/dist/components/filter-chip/filter-chip.component.d.ts.map +1 -1
- package/dist/components/filter-chip/filter-chip.component.js +1 -1
- package/dist/components/filter-chip/filter-chip.styles.d.ts +6 -10
- package/dist/components/filter-chip/filter-chip.styles.d.ts.map +1 -1
- package/dist/components/filter-chip/filter-chip.styles.js +4 -5
- package/dist/components/input/input.component.d.ts +1 -1
- package/dist/components/input/input.component.d.ts.map +1 -1
- package/dist/components/product-card/product-card.component.d.ts.map +1 -1
- package/dist/components/product-card/product-card.component.js +3 -3
- 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":"button.component.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAiB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"button.component.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAiB,MAAM,gBAAgB,CAAC;AAqC5D,eAAO,MAAM,MAAM,yCAA8B,CAAC"}
|
|
@@ -12,9 +12,7 @@ const ButtonComponent = ({ label, loading, variant, fullWidth, size, disabled, .
|
|
|
12
12
|
});
|
|
13
13
|
const { icon: Icon } = rest;
|
|
14
14
|
const { colors } = useTheme();
|
|
15
|
-
return (_jsx(TouchableOpacity, { style: [buttonStyle.container, disabled && buttonStyle.disabled], ...rest, children: loading ? (
|
|
16
|
-
// <ActivityIndicator color="#fff" size="small" animating={true} />
|
|
17
|
-
_jsx(Loading, { size: 28, containerStyle: { padding: 0 } })) : (_jsxs(_Fragment, { children: [rest.icon && _jsx(Icon, { stroke: 0.5, color: colors.backgroundAction1 }), _jsx(Text, { style: buttonStyle.buttonText, children: label })] })) }));
|
|
15
|
+
return (_jsx(TouchableOpacity, { style: [buttonStyle.container, disabled && buttonStyle.disabled], ...rest, children: loading ? (_jsx(Loading, { size: 28, containerStyle: { padding: 0 } })) : (_jsxs(_Fragment, { children: [rest.icon && _jsx(Icon, { stroke: 0.5, color: colors.backgroundAction1 }), _jsx(Text, { style: buttonStyle.buttonText, children: label })] })) }));
|
|
18
16
|
};
|
|
19
17
|
export const Button = React.memo(ButtonComponent);
|
|
20
18
|
Button.displayName = "Button";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TouchableOpacityProps } from "react-native";
|
|
1
2
|
export type ButtonProps = {
|
|
2
3
|
onPress?: () => void;
|
|
3
4
|
label?: string;
|
|
@@ -5,9 +6,9 @@ export type ButtonProps = {
|
|
|
5
6
|
variant?: "primary" | "primary-inverted" | "secondary" | "secondary-inverted" | "converted" | "danger" | "danger-inverted" | "danger-outline";
|
|
6
7
|
fullWidth?: boolean;
|
|
7
8
|
size?: "small" | "medium" | "large";
|
|
8
|
-
icon?: any;
|
|
9
|
+
icon?: React.ReactNode | React.ReactElement | any;
|
|
9
10
|
disabled?: boolean;
|
|
10
|
-
};
|
|
11
|
+
} & TouchableOpacityProps;
|
|
11
12
|
export declare enum ButtonVariant {
|
|
12
13
|
primary = "primary",
|
|
13
14
|
primaryInverted = "primary-inverted",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.props.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.props.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EACJ,SAAS,GACT,kBAAkB,GAClB,WAAW,GACX,oBAAoB,GACpB,WAAW,GACX,QAAQ,GACR,iBAAiB,GACjB,gBAAgB,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,IAAI,CAAC,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"button.props.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EACJ,SAAS,GACT,kBAAkB,GAClB,WAAW,GACX,oBAAoB,GACpB,WAAW,GACX,QAAQ,GACR,iBAAiB,GACjB,gBAAgB,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,GAAG,GAAG,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,qBAAqB,CAAC;AAE1B,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,eAAe,qBAAqB;IACpC,SAAS,cAAc;IACvB,iBAAiB,uBAAuB;IACxC,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,cAAc,oBAAoB;IAClC,aAAa,mBAAmB;CACjC;AAED,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-chip.component.d.ts","sourceRoot":"","sources":["../../../src/components/filter-chip/filter-chip.component.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter-chip.component.d.ts","sourceRoot":"","sources":["../../../src/components/filter-chip/filter-chip.component.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAkEtD,eAAO,MAAM,UAAU,6CAAkC,CAAC"}
|
|
@@ -13,7 +13,7 @@ const FilterChipComponent = ({ label, selected = false, count, onPress, style, t
|
|
|
13
13
|
const renderContent = () => {
|
|
14
14
|
// Caso 1: Chip com ícone de filtro e contador (sem label)
|
|
15
15
|
if (!label && count !== undefined) {
|
|
16
|
-
return (_jsxs(View, { style: styles.countContainer, children: [_jsx(SlidersIcon, { color: selected ? theme.colors.textPrimary : theme.colors.textSecondary, size: 20, style: styles.icon }), _jsx(Text, { style: styles.countText, children: count })] }));
|
|
16
|
+
return (_jsxs(View, { style: styles.countContainer, children: [_jsx(SlidersIcon, { color: selected ? theme.colors.textPrimary : theme.colors.textSecondary, size: 20, style: styles.icon }), count > 0 && _jsx(Text, { style: styles.countText, children: count })] }));
|
|
17
17
|
}
|
|
18
18
|
// Caso 2: Chip com label e botão de ação (+ ou X)
|
|
19
19
|
if (label) {
|
|
@@ -5,7 +5,7 @@ export declare const useFilterChipStyles: (variant?: FilterChipVariant) => {
|
|
|
5
5
|
flexDirection: "row";
|
|
6
6
|
alignItems: "center";
|
|
7
7
|
paddingHorizontal: 16;
|
|
8
|
-
paddingVertical:
|
|
8
|
+
paddingVertical: 16;
|
|
9
9
|
borderRadius: 360;
|
|
10
10
|
borderWidth: 1;
|
|
11
11
|
backgroundColor: "#FFFFFF";
|
|
@@ -22,14 +22,12 @@ export declare const useFilterChipStyles: (variant?: FilterChipVariant) => {
|
|
|
22
22
|
color: "#101010";
|
|
23
23
|
fontFamily: "Inter-Medium";
|
|
24
24
|
fontSize: 14;
|
|
25
|
-
marginLeft: 8;
|
|
26
|
-
};
|
|
27
|
-
icon: {
|
|
28
|
-
marginRight: 4;
|
|
29
25
|
};
|
|
26
|
+
icon: {};
|
|
30
27
|
countContainer: {
|
|
31
28
|
flexDirection: "row";
|
|
32
29
|
alignItems: "center";
|
|
30
|
+
gap: 8;
|
|
33
31
|
};
|
|
34
32
|
actionIcon: {
|
|
35
33
|
marginLeft: 8;
|
|
@@ -39,7 +37,7 @@ export declare const useFilterChipStyles: (variant?: FilterChipVariant) => {
|
|
|
39
37
|
flexDirection: "row";
|
|
40
38
|
alignItems: "center";
|
|
41
39
|
paddingHorizontal: 16;
|
|
42
|
-
paddingVertical:
|
|
40
|
+
paddingVertical: 16;
|
|
43
41
|
borderRadius: 360;
|
|
44
42
|
borderWidth: 1;
|
|
45
43
|
borderColor: "#D9DDE1";
|
|
@@ -53,18 +51,16 @@ export declare const useFilterChipStyles: (variant?: FilterChipVariant) => {
|
|
|
53
51
|
lineHeight: number;
|
|
54
52
|
letterSpacing: number;
|
|
55
53
|
};
|
|
56
|
-
icon: {
|
|
57
|
-
marginRight: 4;
|
|
58
|
-
};
|
|
54
|
+
icon: {};
|
|
59
55
|
countContainer: {
|
|
60
56
|
flexDirection: "row";
|
|
61
57
|
alignItems: "center";
|
|
58
|
+
gap: 8;
|
|
62
59
|
};
|
|
63
60
|
countText: {
|
|
64
61
|
fontFamily: "Inter-Medium";
|
|
65
62
|
fontSize: 14;
|
|
66
63
|
color: "#101010";
|
|
67
|
-
marginLeft: 8;
|
|
68
64
|
};
|
|
69
65
|
actionIcon: {
|
|
70
66
|
marginLeft: 8;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-chip.styles.d.ts","sourceRoot":"","sources":["../../../src/components/filter-chip/filter-chip.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAO,MAAM,mBAAmB,GAAI,UAAS,iBAA6B
|
|
1
|
+
{"version":3,"file":"filter-chip.styles.d.ts","sourceRoot":"","sources":["../../../src/components/filter-chip/filter-chip.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAO,MAAM,mBAAmB,GAAI,UAAS,iBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFzE,CAAC"}
|
|
@@ -9,7 +9,7 @@ export const useFilterChipStyles = (variant = "default") => {
|
|
|
9
9
|
flexDirection: "row",
|
|
10
10
|
alignItems: "center",
|
|
11
11
|
paddingHorizontal: theme.spacing.md,
|
|
12
|
-
paddingVertical: theme.spacing.
|
|
12
|
+
paddingVertical: theme.spacing.md,
|
|
13
13
|
borderRadius: theme.radius.round,
|
|
14
14
|
borderWidth: theme.borderWidth.sm,
|
|
15
15
|
borderColor: theme.colors.borderSecondary,
|
|
@@ -23,18 +23,17 @@ export const useFilterChipStyles = (variant = "default") => {
|
|
|
23
23
|
lineHeight: 21,
|
|
24
24
|
letterSpacing: 0,
|
|
25
25
|
},
|
|
26
|
-
icon: {
|
|
27
|
-
marginRight: theme.spacing.xxs,
|
|
28
|
-
},
|
|
26
|
+
icon: {},
|
|
29
27
|
countContainer: {
|
|
30
28
|
flexDirection: "row",
|
|
31
29
|
alignItems: "center",
|
|
30
|
+
gap: theme.spacing.xs,
|
|
32
31
|
},
|
|
33
32
|
countText: {
|
|
34
33
|
fontFamily: theme.fonts.inter.medium,
|
|
35
34
|
fontSize: theme.fonts.sizes.xs,
|
|
36
35
|
color: theme.colors.textPrimary,
|
|
37
|
-
marginLeft: theme.spacing.xs,
|
|
36
|
+
// marginLeft: theme.spacing.xs,
|
|
38
37
|
},
|
|
39
38
|
actionIcon: {
|
|
40
39
|
marginLeft: theme.spacing.xs,
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { TextInputProps } from "react-native";
|
|
3
3
|
type MaskType = "cpf" | "phone" | "date" | "cep" | "custom";
|
|
4
4
|
interface InputProps extends TextInputProps {
|
|
5
|
-
label
|
|
5
|
+
label?: string;
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
error?: string;
|
|
8
8
|
value?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA6B,cAAc,EAAQ,MAAM,cAAc,CAAC;AAK/E,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE5D,UAAU,UAAW,SAAQ,cAAc;IACzC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA6B,cAAc,EAAQ,MAAM,cAAc,CAAC;AAK/E,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE5D,UAAU,UAAW,SAAQ,cAAc;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2KD,eAAO,MAAM,KAAK,wCAA6B,CAAC"}
|
|
@@ -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();
|
|
@@ -14,7 +14,7 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
14
14
|
(flags === null || flags === void 0 ? void 0 : flags.length) > 0 &&
|
|
15
15
|
(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)))), variant === "grid" && (_jsx(TouchableOpacity, { style: [
|
|
16
16
|
isFavorite ? styles.favoriteButton : styles.unfavoriteButton,
|
|
17
|
-
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: _jsx(HeartIcon, { size: 20, color: "#101010", fill: isFavorite ? "#101010" : "transparent" }) }))] }), variant !== "lastViewed" && (_jsxs(View, { style: styles.detailsContainer, children: [_jsxs(View, { style: styles.productInfo, children: [
|
|
17
|
+
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: _jsx(HeartIcon, { size: 20, color: "#101010", fill: isFavorite ? "#101010" : "transparent" }) }))] }), 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" && (_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 }) })] }))] })), [
|
|
18
18
|
brand,
|
|
19
19
|
handleFavoritePress,
|
|
20
20
|
imageUrl,
|
|
@@ -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"}
|