decathlon-ui 0.3.24 → 0.3.26
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/card-picto/card-picto.component.d.ts +3 -0
- package/dist/components/card-picto/card-picto.component.d.ts.map +1 -0
- package/dist/components/card-picto/card-picto.component.js +17 -0
- package/dist/components/card-picto/card-picto.styles.d.ts +27 -0
- package/dist/components/card-picto/card-picto.styles.d.ts.map +1 -0
- package/dist/components/card-picto/card-picto.styles.js +42 -0
- package/dist/components/card-picto/card-picto.types.d.ts +8 -0
- package/dist/components/card-picto/card-picto.types.d.ts.map +1 -0
- package/dist/components/card-picto/card-picto.types.js +1 -0
- package/dist/components/card-picto/index.d.ts +2 -0
- package/dist/components/card-picto/index.d.ts.map +1 -0
- package/dist/components/card-picto/index.js +1 -0
- package/dist/components/card-sport/card-sport.component.d.ts +3 -0
- package/dist/components/card-sport/card-sport.component.d.ts.map +1 -0
- package/dist/components/card-sport/card-sport.component.js +7 -0
- package/dist/components/card-sport/card-sport.styles.d.ts +21 -0
- package/dist/components/card-sport/card-sport.styles.d.ts.map +1 -0
- package/dist/components/card-sport/card-sport.styles.js +25 -0
- package/dist/components/card-sport/card-sport.types.d.ts +6 -0
- package/dist/components/card-sport/card-sport.types.d.ts.map +1 -0
- package/dist/components/card-sport/card-sport.types.js +1 -0
- package/dist/components/card-sport/index.d.ts +2 -0
- package/dist/components/card-sport/index.d.ts.map +1 -0
- package/dist/components/card-sport/index.js +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/product-card/product-card.component.js +2 -2
- package/dist/components/store-card/index.d.ts +2 -0
- package/dist/components/store-card/index.d.ts.map +1 -0
- package/dist/components/store-card/index.js +1 -0
- package/dist/components/store-card/store-card.component.d.ts +3 -0
- package/dist/components/store-card/store-card.component.d.ts.map +1 -0
- package/dist/components/store-card/store-card.component.js +51 -0
- package/dist/components/store-card/store-card.styles.d.ts +115 -0
- package/dist/components/store-card/store-card.styles.d.ts.map +1 -0
- package/dist/components/store-card/store-card.styles.js +115 -0
- package/dist/components/store-card/store-card.types.d.ts +23 -0
- package/dist/components/store-card/store-card.types.d.ts.map +1 -0
- package/dist/components/store-card/store-card.types.js +1 -0
- package/dist/components/store-card/styles.d.ts +103 -0
- package/dist/components/store-card/styles.d.ts.map +1 -0
- package/dist/components/store-card/styles.js +103 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast.component.d.ts +11 -0
- package/dist/components/toast/toast.component.d.ts.map +1 -0
- package/dist/components/toast/toast.component.js +42 -0
- package/dist/components/toast/toast.styles.d.ts +16 -0
- package/dist/components/toast/toast.styles.d.ts.map +1 -0
- package/dist/components/toast/toast.styles.js +58 -0
- package/dist/components/toast/toast.types.d.ts +10 -0
- package/dist/components/toast/toast.types.d.ts.map +1 -0
- package/dist/components/toast/toast.types.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-picto.component.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/card-picto.component.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAmB,GACpB,EAAE,cAAc,2CAmBhB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Image, Text, TouchableOpacity } from "react-native";
|
|
3
|
+
let FastImageComponent = null;
|
|
4
|
+
try {
|
|
5
|
+
// Tenta importar o FastImage
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
+
FastImageComponent = require("react-native-fast-image").default;
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
// Se não existir, permanece null
|
|
11
|
+
}
|
|
12
|
+
const CardImage = FastImageComponent ? FastImageComponent : Image;
|
|
13
|
+
import { useCardPictoStyles } from "./card-picto.styles";
|
|
14
|
+
export function CardPicto({ title, image, onPress, variant = "default", }) {
|
|
15
|
+
const styles = useCardPictoStyles(variant);
|
|
16
|
+
return (_jsxs(TouchableOpacity, { style: styles.container, onPress: onPress, activeOpacity: 0.7, children: [_jsx(CardImage, { source: { uri: image }, style: styles.image, resizeMode: FastImageComponent ? FastImageComponent.resizeMode.contain : "contain" }), _jsx(Text, { style: styles.title, children: title })] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CardPictoVariant } from "./card-picto.types";
|
|
2
|
+
export declare const useCardPictoStyles: (variant: CardPictoVariant) => {
|
|
3
|
+
container: {};
|
|
4
|
+
image: {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
title: {
|
|
9
|
+
textAlign: "center";
|
|
10
|
+
color: "#101010";
|
|
11
|
+
fontSize: 14;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
container: {
|
|
15
|
+
width: number;
|
|
16
|
+
};
|
|
17
|
+
image: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
title: {
|
|
22
|
+
textAlign: "center";
|
|
23
|
+
color: "#101010";
|
|
24
|
+
fontSize: 14;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=card-picto.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-picto.styles.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/card-picto.styles.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAAI,SAAS,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CA0C3D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { useTheme } from "../../themes";
|
|
3
|
+
export const useCardPictoStyles = (variant) => {
|
|
4
|
+
const { colors, fonts, spacing } = useTheme();
|
|
5
|
+
const baseStyles = StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
marginHorizontal: spacing.xxs,
|
|
9
|
+
},
|
|
10
|
+
image: {
|
|
11
|
+
borderRadius: 30,
|
|
12
|
+
marginBottom: spacing.xs,
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
textAlign: "center",
|
|
16
|
+
color: colors.textPrimary,
|
|
17
|
+
fontSize: fonts.sizes.xs,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const variantStyles = {
|
|
21
|
+
default: StyleSheet.create({
|
|
22
|
+
container: {},
|
|
23
|
+
image: {
|
|
24
|
+
width: 75,
|
|
25
|
+
height: 75,
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
compact: StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
width: 60,
|
|
31
|
+
},
|
|
32
|
+
image: {
|
|
33
|
+
width: 48,
|
|
34
|
+
height: 48,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
...baseStyles,
|
|
40
|
+
...variantStyles[variant],
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-picto.types.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/card-picto.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./card-picto.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-sport.component.d.ts","sourceRoot":"","sources":["../../../src/components/card-sport/card-sport.component.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,eAAe,2CAcpE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ImageBackground, Text, TouchableOpacity } from "react-native";
|
|
3
|
+
import { useCardSportsStyles } from "./card-sport.styles";
|
|
4
|
+
export function CardSports({ title, image, onPress }) {
|
|
5
|
+
const styles = useCardSportsStyles();
|
|
6
|
+
return (_jsx(TouchableOpacity, { onPress: onPress, style: styles.container, children: _jsx(ImageBackground, { source: { uri: image }, style: styles.background, imageStyle: styles.image, children: _jsx(Text, { style: styles.title, children: title }) }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const useCardSportsStyles: () => {
|
|
2
|
+
container: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
overflow: "hidden";
|
|
6
|
+
};
|
|
7
|
+
background: {
|
|
8
|
+
flex: number;
|
|
9
|
+
justifyContent: "flex-end";
|
|
10
|
+
padding: 16;
|
|
11
|
+
};
|
|
12
|
+
image: {};
|
|
13
|
+
title: {
|
|
14
|
+
color: "#FFFFFF";
|
|
15
|
+
fontSize: 14;
|
|
16
|
+
fontWeight: "500";
|
|
17
|
+
lineHeight: number;
|
|
18
|
+
textAlign: "left";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=card-sport.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-sport.styles.d.ts","sourceRoot":"","sources":["../../../src/components/card-sport/card-sport.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CAuB/B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { useTheme } from "../../themes";
|
|
3
|
+
export const useCardSportsStyles = () => {
|
|
4
|
+
const { colors, spacing, fonts } = useTheme();
|
|
5
|
+
return StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
width: 160,
|
|
8
|
+
height: 200,
|
|
9
|
+
overflow: "hidden",
|
|
10
|
+
},
|
|
11
|
+
background: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
justifyContent: "flex-end",
|
|
14
|
+
padding: spacing.md,
|
|
15
|
+
},
|
|
16
|
+
image: {},
|
|
17
|
+
title: {
|
|
18
|
+
color: colors.white,
|
|
19
|
+
fontSize: fonts.sizes.xs,
|
|
20
|
+
fontWeight: "500",
|
|
21
|
+
lineHeight: 16.8,
|
|
22
|
+
textAlign: "left",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-sport.types.d.ts","sourceRoot":"","sources":["../../../src/components/card-sport/card-sport.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/card-sport/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./card-sport.component";
|
|
@@ -3,6 +3,8 @@ export * from "./action-button/index";
|
|
|
3
3
|
export * from "./badge/index";
|
|
4
4
|
export * from "./banner-carousel/index";
|
|
5
5
|
export * from "./button/index";
|
|
6
|
+
export * from "./card-picto/index";
|
|
7
|
+
export * from "./card-sport/index";
|
|
6
8
|
export * from "./card/index";
|
|
7
9
|
export * from "./cashback-banner/index";
|
|
8
10
|
export * from "./category-item/index";
|
|
@@ -23,6 +25,8 @@ export * from "./range-slider/index";
|
|
|
23
25
|
export * from "./search-button/index";
|
|
24
26
|
export * from "./select/index";
|
|
25
27
|
export * from "./seller-box/index";
|
|
28
|
+
export * from "./store-card/index";
|
|
29
|
+
export * from "./toast/index";
|
|
26
30
|
export * from "./toggle-switch/index";
|
|
27
31
|
export * from "./typography/index";
|
|
28
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -3,6 +3,8 @@ export * from "./action-button/index";
|
|
|
3
3
|
export * from "./badge/index";
|
|
4
4
|
export * from "./banner-carousel/index";
|
|
5
5
|
export * from "./button/index";
|
|
6
|
+
export * from "./card-picto/index";
|
|
7
|
+
export * from "./card-sport/index";
|
|
6
8
|
export * from "./card/index";
|
|
7
9
|
export * from "./cashback-banner/index";
|
|
8
10
|
export * from "./category-item/index";
|
|
@@ -23,5 +25,7 @@ export * from "./range-slider/index";
|
|
|
23
25
|
export * from "./search-button/index";
|
|
24
26
|
export * from "./select/index";
|
|
25
27
|
export * from "./seller-box/index";
|
|
28
|
+
export * from "./store-card/index";
|
|
29
|
+
export * from "./toast/index";
|
|
26
30
|
export * from "./toggle-switch/index";
|
|
27
31
|
export * from "./typography/index";
|
|
@@ -15,13 +15,13 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
15
15
|
}, [onFavoritePress]);
|
|
16
16
|
const renderContent = React.useCallback(() => (_jsxs(View, { style: [styles.cardContainer, customStyles], 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) &&
|
|
17
17
|
(flags === null || flags === void 0 ? void 0 : flags.length) > 0 &&
|
|
18
|
-
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, textStyle: { color: flag.textColor }, iconPosition: "right", size: "small", style: {
|
|
18
|
+
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, textStyle: { color: flag.textColor, fontWeight: "bold" }, iconPosition: "right", size: "small", style: {
|
|
19
19
|
position: "absolute",
|
|
20
20
|
top: 0,
|
|
21
21
|
left: 0,
|
|
22
22
|
backgroundColor: flag.color,
|
|
23
23
|
padding: theme.spacing.xxs2,
|
|
24
|
-
}, icon: flag.icon }, flag.name + index + productName)))),
|
|
24
|
+
}, icon: flag.icon }, flag.name + index + productName)))), showFavoriteButton && (_jsx(TouchableOpacity, { style: [
|
|
25
25
|
isFavorite ? styles.favoriteButton : styles.unfavoriteButton,
|
|
26
26
|
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: isLoadingFavorite ? (_jsx(Loading, { size: 16 })) : isFavorite ? (_jsx(HeartFillIcon, { size: 16, color: "#101010" })) : (_jsx(HeartIcon, { size: 16, 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 }) })] }))] })), [
|
|
27
27
|
brand,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StoreCard } from './store-card.component';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { StoreCardProps } from "./store-card.types";
|
|
2
|
+
export declare const StoreCard: ({ storeName, address, distance, itemsAvailable, itemsUnavailable, pickupTime, flags, value, onPress, isSelected, }: StoreCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=store-card.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/store-card.component.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA8BpD,eAAO,MAAM,SAAS,GAAI,oHAWvB,cAAc,4CAsFhB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { CalendarIcon, MapPinIcon } from "../../icons";
|
|
4
|
+
import { useTheme } from "../../themes";
|
|
5
|
+
import { Badge } from "../badge";
|
|
6
|
+
import { useStoreCardStyles } from "./store-card.styles";
|
|
7
|
+
let FastImageComponent = null;
|
|
8
|
+
try {
|
|
9
|
+
// Tenta importar o FastImage
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
+
FastImageComponent = require("react-native-fast-image").default;
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
// Se não existir, permanece null
|
|
15
|
+
}
|
|
16
|
+
// Fallback para quando FastImage não estiver disponível (ex: Storybook web)
|
|
17
|
+
if (!FastImageComponent) {
|
|
18
|
+
FastImageComponent = ({ source, style, ...props }) => (_jsx(View, { style: [
|
|
19
|
+
style,
|
|
20
|
+
{
|
|
21
|
+
backgroundColor: "#e0e0e0",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
},
|
|
25
|
+
], ...props, children: _jsx(Text, { style: { fontSize: 12, color: "#666" }, children: "IMG" }) }));
|
|
26
|
+
}
|
|
27
|
+
export const StoreCard = ({ storeName, address, distance, itemsAvailable, itemsUnavailable, pickupTime, flags, value, onPress, isSelected, }) => {
|
|
28
|
+
const { spacing, fonts, colors, metrics } = useTheme();
|
|
29
|
+
const allAvailable = (itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.length) === 0;
|
|
30
|
+
const styles = useStoreCardStyles({
|
|
31
|
+
allAvailable,
|
|
32
|
+
});
|
|
33
|
+
return (_jsxs(TouchableOpacity, { onPress: onPress, style: [styles.container, isSelected && styles.isSelected], children: [_jsxs(View, { style: styles.header, children: [_jsx(Text, { style: styles.storeName, children: storeName }), _jsxs(View, { style: styles.tagsContainer, children: [flags === null || flags === void 0 ? void 0 : flags.map((flag) => {
|
|
34
|
+
const variants = {
|
|
35
|
+
free: "default",
|
|
36
|
+
cashback: "cashback",
|
|
37
|
+
};
|
|
38
|
+
return (
|
|
39
|
+
// TODO: adicionar tipo para flags
|
|
40
|
+
_jsx(Badge, { variant: variants[flag], text: flag }, flag));
|
|
41
|
+
}), value && _jsx(Text, { style: styles.value, children: value })] })] }), _jsxs(View, { style: styles.availableItemsContainer, children: [_jsxs(View, { style: styles.availableItemsContainerText, children: [_jsx(View, { style: styles.storeCard }), _jsx(Text, { style: styles.itemsAvailable, children: !(itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.length)
|
|
42
|
+
? "Todos itens disponíveis"
|
|
43
|
+
: `${itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.length} indisponíveis` })] }), _jsxs(View, { style: styles.availableItemsContainerText, children: [_jsx(CalendarIcon, { size: 10 }), _jsx(Text, { style: styles.pickupTime, children: pickupTime })] })] }), _jsxs(View, { style: {
|
|
44
|
+
gap: spacing.sm,
|
|
45
|
+
flexDirection: "row",
|
|
46
|
+
}, children: [itemsAvailable === null || itemsAvailable === void 0 ? void 0 : itemsAvailable.map((item) => (_jsx(FastImageComponent, { source: {
|
|
47
|
+
uri: item.imageUrl,
|
|
48
|
+
}, style: styles.image }, item.itemIndex))), itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.map((item) => (_jsxs(View, { children: [_jsx(FastImageComponent, { source: {
|
|
49
|
+
uri: item.imageUrl,
|
|
50
|
+
}, style: styles.image }), _jsx(View, { style: styles.unavailableItemContainer, children: _jsx(View, { style: styles.unavailableItem }) })] }, item.itemIndex)))] }), _jsxs(View, { style: styles.footer, children: [_jsx(Text, { style: styles.address, children: address }), _jsxs(View, { style: styles.availableItemsContainerText, children: [_jsx(MapPinIcon, { size: 13 }), _jsx(Text, { style: styles.distance, children: distance })] })] })] }));
|
|
51
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export declare const useStoreCardStyles: ({ allAvailable, }: {
|
|
2
|
+
allAvailable: boolean;
|
|
3
|
+
}) => {
|
|
4
|
+
container: {
|
|
5
|
+
width: "100%";
|
|
6
|
+
backgroundColor: "#FFFFFF";
|
|
7
|
+
padding: 8;
|
|
8
|
+
gap: 16;
|
|
9
|
+
borderBottomWidth: number;
|
|
10
|
+
borderBottomColor: "#D9DDE1";
|
|
11
|
+
paddingBottom: 16;
|
|
12
|
+
};
|
|
13
|
+
header: {
|
|
14
|
+
flexDirection: "row";
|
|
15
|
+
justifyContent: "space-between";
|
|
16
|
+
alignItems: "center";
|
|
17
|
+
marginBottom: 8;
|
|
18
|
+
};
|
|
19
|
+
storeName: {
|
|
20
|
+
fontSize: 14;
|
|
21
|
+
fontWeight: "600";
|
|
22
|
+
lineHeight: number;
|
|
23
|
+
color: "#101010";
|
|
24
|
+
textAlign: "left";
|
|
25
|
+
};
|
|
26
|
+
itemsAvailable: {
|
|
27
|
+
fontSize: 12;
|
|
28
|
+
fontWeight: "400";
|
|
29
|
+
lineHeight: number;
|
|
30
|
+
textAlign: "left";
|
|
31
|
+
color: "#616161" | "#DB6900";
|
|
32
|
+
};
|
|
33
|
+
pickupTime: {
|
|
34
|
+
fontSize: 12;
|
|
35
|
+
fontWeight: "400";
|
|
36
|
+
lineHeight: number;
|
|
37
|
+
textAlign: "left";
|
|
38
|
+
color: "#616161";
|
|
39
|
+
};
|
|
40
|
+
footer: {
|
|
41
|
+
flexDirection: "row";
|
|
42
|
+
justifyContent: "space-between";
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
};
|
|
45
|
+
address: {
|
|
46
|
+
fontSize: 10;
|
|
47
|
+
fontWeight: "400";
|
|
48
|
+
lineHeight: number;
|
|
49
|
+
textAlign: "left";
|
|
50
|
+
color: "#616161";
|
|
51
|
+
};
|
|
52
|
+
distance: {
|
|
53
|
+
fontSize: 12;
|
|
54
|
+
fontWeight: "600";
|
|
55
|
+
lineHeight: number;
|
|
56
|
+
textAlign: "left";
|
|
57
|
+
color: "#383838";
|
|
58
|
+
flexDirection: "row";
|
|
59
|
+
alignItems: "center";
|
|
60
|
+
};
|
|
61
|
+
image: {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
value: {
|
|
66
|
+
fontSize: 14;
|
|
67
|
+
fontWeight: "600";
|
|
68
|
+
lineHeight: number;
|
|
69
|
+
textAlign: "right";
|
|
70
|
+
color: "#3643BA";
|
|
71
|
+
};
|
|
72
|
+
storeCard: {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
backgroundColor: "#006F43" | "#DB6900";
|
|
76
|
+
borderRadius: number;
|
|
77
|
+
};
|
|
78
|
+
isSelected: {
|
|
79
|
+
borderWidth: number;
|
|
80
|
+
borderColor: "#3643BA";
|
|
81
|
+
borderBottomColor: "#3643BA";
|
|
82
|
+
};
|
|
83
|
+
unavailableItemContainer: {
|
|
84
|
+
position: "absolute";
|
|
85
|
+
top: number;
|
|
86
|
+
left: number;
|
|
87
|
+
right: number;
|
|
88
|
+
bottom: number;
|
|
89
|
+
backgroundColor: string;
|
|
90
|
+
justifyContent: "center";
|
|
91
|
+
alignItems: "center";
|
|
92
|
+
};
|
|
93
|
+
unavailableItem: {
|
|
94
|
+
width: "130%";
|
|
95
|
+
height: number;
|
|
96
|
+
backgroundColor: "#949494";
|
|
97
|
+
position: "absolute";
|
|
98
|
+
transform: {
|
|
99
|
+
rotate: string;
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
102
|
+
tagsContainer: {
|
|
103
|
+
flexDirection: "row";
|
|
104
|
+
gap: 4;
|
|
105
|
+
};
|
|
106
|
+
availableItemsContainerText: {
|
|
107
|
+
gap: 4;
|
|
108
|
+
flexDirection: "row";
|
|
109
|
+
alignItems: "center";
|
|
110
|
+
};
|
|
111
|
+
availableItemsContainer: {
|
|
112
|
+
gap: 2;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=store-card.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/store-card.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,GAAI,mBAEhC;IACD,YAAY,EAAE,OAAO,CAAC;CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHA,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { useTheme } from "../../themes";
|
|
3
|
+
export const useStoreCardStyles = ({ allAvailable, }) => {
|
|
4
|
+
const { colors, fonts, spacing } = useTheme();
|
|
5
|
+
return StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
width: "100%",
|
|
8
|
+
backgroundColor: colors.backgroundPrimary,
|
|
9
|
+
padding: spacing.xs,
|
|
10
|
+
gap: spacing.md,
|
|
11
|
+
borderBottomWidth: 1,
|
|
12
|
+
borderBottomColor: colors.borderSecondary,
|
|
13
|
+
paddingBottom: spacing.md,
|
|
14
|
+
},
|
|
15
|
+
header: {
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
justifyContent: "space-between",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
marginBottom: spacing.xs,
|
|
20
|
+
},
|
|
21
|
+
storeName: {
|
|
22
|
+
fontSize: fonts.sizes.xs,
|
|
23
|
+
fontWeight: "600",
|
|
24
|
+
lineHeight: 21,
|
|
25
|
+
color: colors.textPrimary,
|
|
26
|
+
textAlign: "left",
|
|
27
|
+
},
|
|
28
|
+
itemsAvailable: {
|
|
29
|
+
fontSize: fonts.sizes.xxs,
|
|
30
|
+
fontWeight: "400",
|
|
31
|
+
lineHeight: 18,
|
|
32
|
+
textAlign: "left",
|
|
33
|
+
color: allAvailable ? colors.textTertiary : colors.textHighlight, // TODO: ajustar a lógica para pegar o length do array
|
|
34
|
+
},
|
|
35
|
+
pickupTime: {
|
|
36
|
+
fontSize: fonts.sizes.xxs,
|
|
37
|
+
fontWeight: "400",
|
|
38
|
+
lineHeight: 18,
|
|
39
|
+
textAlign: "left",
|
|
40
|
+
color: colors.textTertiary,
|
|
41
|
+
},
|
|
42
|
+
footer: {
|
|
43
|
+
flexDirection: "row",
|
|
44
|
+
justifyContent: "space-between",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
},
|
|
47
|
+
address: {
|
|
48
|
+
fontSize: fonts.sizes.xxxs,
|
|
49
|
+
fontWeight: "400",
|
|
50
|
+
lineHeight: 10,
|
|
51
|
+
textAlign: "left",
|
|
52
|
+
color: colors.textTertiary,
|
|
53
|
+
},
|
|
54
|
+
distance: {
|
|
55
|
+
fontSize: fonts.sizes.xxs,
|
|
56
|
+
fontWeight: "600",
|
|
57
|
+
lineHeight: 18,
|
|
58
|
+
textAlign: "left",
|
|
59
|
+
color: colors.textSecondary,
|
|
60
|
+
flexDirection: "row",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
},
|
|
63
|
+
image: {
|
|
64
|
+
width: 48,
|
|
65
|
+
height: 48,
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
fontSize: fonts.sizes.xs,
|
|
69
|
+
fontWeight: "600",
|
|
70
|
+
lineHeight: 21,
|
|
71
|
+
textAlign: "right",
|
|
72
|
+
color: colors.textAction,
|
|
73
|
+
},
|
|
74
|
+
storeCard: {
|
|
75
|
+
width: 9,
|
|
76
|
+
height: 9,
|
|
77
|
+
backgroundColor: allAvailable ? colors.textSuccess : colors.textHighlight,
|
|
78
|
+
borderRadius: 10,
|
|
79
|
+
},
|
|
80
|
+
isSelected: {
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: colors.primary,
|
|
83
|
+
borderBottomColor: colors.primary,
|
|
84
|
+
},
|
|
85
|
+
unavailableItemContainer: {
|
|
86
|
+
position: "absolute",
|
|
87
|
+
top: 0,
|
|
88
|
+
left: 0,
|
|
89
|
+
right: 0,
|
|
90
|
+
bottom: 0,
|
|
91
|
+
backgroundColor: "rgba(255,255,255,0.7)",
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
},
|
|
95
|
+
unavailableItem: {
|
|
96
|
+
width: "130%",
|
|
97
|
+
height: 1,
|
|
98
|
+
backgroundColor: colors.textDisabled,
|
|
99
|
+
position: "absolute",
|
|
100
|
+
transform: [{ rotate: "130deg" }],
|
|
101
|
+
},
|
|
102
|
+
tagsContainer: {
|
|
103
|
+
flexDirection: "row",
|
|
104
|
+
gap: spacing.xxs,
|
|
105
|
+
},
|
|
106
|
+
availableItemsContainerText: {
|
|
107
|
+
gap: spacing.xxs,
|
|
108
|
+
flexDirection: "row",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
},
|
|
111
|
+
availableItemsContainer: {
|
|
112
|
+
gap: spacing.xxxs,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface StoreCardProps {
|
|
2
|
+
storeName: string;
|
|
3
|
+
address: string;
|
|
4
|
+
distance: string;
|
|
5
|
+
itemsAvailable?: Array<{
|
|
6
|
+
itemIndex: number;
|
|
7
|
+
imageUrl: string;
|
|
8
|
+
name: string;
|
|
9
|
+
sellerName: string;
|
|
10
|
+
}>;
|
|
11
|
+
itemsUnavailable?: Array<{
|
|
12
|
+
itemIndex?: number;
|
|
13
|
+
imageUrl: string;
|
|
14
|
+
name: string;
|
|
15
|
+
sellerName: string;
|
|
16
|
+
}>;
|
|
17
|
+
pickupTime: string;
|
|
18
|
+
flags?: string[];
|
|
19
|
+
value?: string | number;
|
|
20
|
+
onPress: () => void;
|
|
21
|
+
isSelected?: boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=store-card.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/store-card.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export declare const useStoreCardStyles: ({ allAvailable }: {
|
|
2
|
+
allAvailable: boolean;
|
|
3
|
+
}) => {
|
|
4
|
+
container: {
|
|
5
|
+
width: "100%";
|
|
6
|
+
backgroundColor: any;
|
|
7
|
+
padding: any;
|
|
8
|
+
gap: any;
|
|
9
|
+
borderBottomWidth: number;
|
|
10
|
+
borderBottomColor: any;
|
|
11
|
+
paddingBottom: any;
|
|
12
|
+
};
|
|
13
|
+
header: {
|
|
14
|
+
flexDirection: "row";
|
|
15
|
+
justifyContent: "space-between";
|
|
16
|
+
alignItems: "center";
|
|
17
|
+
marginBottom: any;
|
|
18
|
+
};
|
|
19
|
+
storeName: {
|
|
20
|
+
fontSize: any;
|
|
21
|
+
fontWeight: "600";
|
|
22
|
+
lineHeight: number;
|
|
23
|
+
color: any;
|
|
24
|
+
textAlign: "left";
|
|
25
|
+
};
|
|
26
|
+
itemsAvailable: {
|
|
27
|
+
fontSize: any;
|
|
28
|
+
fontWeight: "400";
|
|
29
|
+
lineHeight: number;
|
|
30
|
+
textAlign: "left";
|
|
31
|
+
color: any;
|
|
32
|
+
};
|
|
33
|
+
pickupTime: {
|
|
34
|
+
fontSize: any;
|
|
35
|
+
fontWeight: "400";
|
|
36
|
+
lineHeight: number;
|
|
37
|
+
textAlign: "left";
|
|
38
|
+
color: any;
|
|
39
|
+
};
|
|
40
|
+
footer: {
|
|
41
|
+
flexDirection: "row";
|
|
42
|
+
justifyContent: "space-between";
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
};
|
|
45
|
+
address: {
|
|
46
|
+
fontSize: any;
|
|
47
|
+
fontWeight: "400";
|
|
48
|
+
lineHeight: number;
|
|
49
|
+
textAlign: "left";
|
|
50
|
+
color: any;
|
|
51
|
+
};
|
|
52
|
+
distance: {
|
|
53
|
+
fontSize: any;
|
|
54
|
+
fontWeight: "600";
|
|
55
|
+
lineHeight: number;
|
|
56
|
+
textAlign: "left";
|
|
57
|
+
color: any;
|
|
58
|
+
flexDirection: "row";
|
|
59
|
+
alignItems: "center";
|
|
60
|
+
};
|
|
61
|
+
image: {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
value: {
|
|
66
|
+
fontSize: any;
|
|
67
|
+
fontWeight: "600";
|
|
68
|
+
lineHeight: number;
|
|
69
|
+
textAlign: "right";
|
|
70
|
+
color: any;
|
|
71
|
+
};
|
|
72
|
+
storeCard: {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
backgroundColor: any;
|
|
76
|
+
borderRadius: number;
|
|
77
|
+
};
|
|
78
|
+
isSelected: {
|
|
79
|
+
borderWidth: number;
|
|
80
|
+
borderColor: any;
|
|
81
|
+
borderBottomColor: any;
|
|
82
|
+
};
|
|
83
|
+
unavailableItemContainer: {
|
|
84
|
+
position: "absolute";
|
|
85
|
+
top: number;
|
|
86
|
+
left: number;
|
|
87
|
+
right: number;
|
|
88
|
+
bottom: number;
|
|
89
|
+
backgroundColor: string;
|
|
90
|
+
justifyContent: "center";
|
|
91
|
+
alignItems: "center";
|
|
92
|
+
};
|
|
93
|
+
unavailableItem: {
|
|
94
|
+
width: "130%";
|
|
95
|
+
height: number;
|
|
96
|
+
backgroundColor: any;
|
|
97
|
+
position: "absolute";
|
|
98
|
+
transform: {
|
|
99
|
+
rotate: string;
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,GAAI,kBAAgB;IAAC,YAAY,EAAE,OAAO,CAAA;CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqGzE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useTheme } from 'decathlon-ui';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
export const useStoreCardStyles = ({ allAvailable }) => {
|
|
4
|
+
const { colors, fonts, spacing } = useTheme();
|
|
5
|
+
return StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
width: '100%',
|
|
8
|
+
backgroundColor: colors.backgroundPrimary,
|
|
9
|
+
padding: spacing.xs,
|
|
10
|
+
gap: spacing.md,
|
|
11
|
+
borderBottomWidth: 1,
|
|
12
|
+
borderBottomColor: colors.borderSecondary,
|
|
13
|
+
paddingBottom: spacing.md,
|
|
14
|
+
},
|
|
15
|
+
header: {
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
marginBottom: spacing.xs,
|
|
20
|
+
},
|
|
21
|
+
storeName: {
|
|
22
|
+
fontSize: fonts.sizes.xs,
|
|
23
|
+
fontWeight: '600',
|
|
24
|
+
lineHeight: 21,
|
|
25
|
+
color: colors.textPrimary,
|
|
26
|
+
textAlign: 'left',
|
|
27
|
+
},
|
|
28
|
+
itemsAvailable: {
|
|
29
|
+
fontSize: fonts.sizes.xxs,
|
|
30
|
+
fontWeight: '400',
|
|
31
|
+
lineHeight: 18,
|
|
32
|
+
textAlign: 'left',
|
|
33
|
+
color: allAvailable ? colors.textTertiary : colors.textHighlight, // TODO: ajustar a lógica para pegar o length do array
|
|
34
|
+
},
|
|
35
|
+
pickupTime: {
|
|
36
|
+
fontSize: fonts.sizes.xxs,
|
|
37
|
+
fontWeight: '400',
|
|
38
|
+
lineHeight: 18,
|
|
39
|
+
textAlign: 'left',
|
|
40
|
+
color: colors.textTertiary,
|
|
41
|
+
},
|
|
42
|
+
footer: {
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
justifyContent: 'space-between',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
},
|
|
47
|
+
address: {
|
|
48
|
+
fontSize: fonts.sizes.xxxs,
|
|
49
|
+
fontWeight: '400',
|
|
50
|
+
lineHeight: 10,
|
|
51
|
+
textAlign: 'left',
|
|
52
|
+
color: colors.textTertiary,
|
|
53
|
+
},
|
|
54
|
+
distance: {
|
|
55
|
+
fontSize: fonts.sizes.xxs,
|
|
56
|
+
fontWeight: '600',
|
|
57
|
+
lineHeight: 18,
|
|
58
|
+
textAlign: 'left',
|
|
59
|
+
color: colors.textSecondary,
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
},
|
|
63
|
+
image: {
|
|
64
|
+
width: 48,
|
|
65
|
+
height: 48,
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
fontSize: fonts.sizes.xs,
|
|
69
|
+
fontWeight: '600',
|
|
70
|
+
lineHeight: 21,
|
|
71
|
+
textAlign: 'right',
|
|
72
|
+
color: colors.textAction,
|
|
73
|
+
},
|
|
74
|
+
storeCard: {
|
|
75
|
+
width: 9,
|
|
76
|
+
height: 9,
|
|
77
|
+
backgroundColor: allAvailable ? colors.textSuccess : colors.textHighlight,
|
|
78
|
+
borderRadius: 10,
|
|
79
|
+
},
|
|
80
|
+
isSelected: {
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: colors.primary,
|
|
83
|
+
borderBottomColor: colors.primary,
|
|
84
|
+
},
|
|
85
|
+
unavailableItemContainer: {
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
top: 0,
|
|
88
|
+
left: 0,
|
|
89
|
+
right: 0,
|
|
90
|
+
bottom: 0,
|
|
91
|
+
backgroundColor: 'rgba(255,255,255,0.7)',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
},
|
|
95
|
+
unavailableItem: {
|
|
96
|
+
width: '130%',
|
|
97
|
+
height: 1,
|
|
98
|
+
backgroundColor: colors.textDisabled,
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
transform: [{ rotate: '130deg' }],
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShowToastParams } from "./toast.types";
|
|
2
|
+
interface ToastProps {
|
|
3
|
+
message: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
type?: ShowToastParams["type"];
|
|
6
|
+
duration?: number;
|
|
7
|
+
onHide: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function Toast({ message, description, type, duration, onHide, }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=toast.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.component.d.ts","sourceRoot":"","sources":["../../../src/components/toast/toast.component.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,WAAW,EACX,IAAa,EACb,QAAe,EACf,MAAM,GACP,EAAE,UAAU,2CA0DZ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useMemo } from "react";
|
|
3
|
+
import { Animated, Text, View } from "react-native";
|
|
4
|
+
import { AlertTriangleIcon, CheckIcon, InfoIcon, XIcon } from "../../icons";
|
|
5
|
+
import { useTheme } from "../../themes";
|
|
6
|
+
import { Button } from "../button";
|
|
7
|
+
import { useToastStyles } from "./toast.styles";
|
|
8
|
+
export function Toast({ message, description, type = "info", duration = 3000, onHide, }) {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const styles = useToastStyles({ type });
|
|
11
|
+
const opacity = useMemo(() => new Animated.Value(0), []);
|
|
12
|
+
const getIcon = () => {
|
|
13
|
+
const icons = {
|
|
14
|
+
success: _jsx(CheckIcon, { size: 24, color: colors.green5 }),
|
|
15
|
+
error: _jsx(XIcon, { size: 24, color: colors.red5 }),
|
|
16
|
+
info: _jsx(InfoIcon, { size: 24, color: colors.blue5 }),
|
|
17
|
+
warning: _jsx(AlertTriangleIcon, { size: 24, color: colors.yellow5 }),
|
|
18
|
+
alert_info: _jsx(_Fragment, {}),
|
|
19
|
+
};
|
|
20
|
+
return icons[type];
|
|
21
|
+
};
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const animation = Animated.sequence([
|
|
24
|
+
Animated.timing(opacity, {
|
|
25
|
+
toValue: 1,
|
|
26
|
+
duration: 300,
|
|
27
|
+
useNativeDriver: true,
|
|
28
|
+
}),
|
|
29
|
+
Animated.delay(duration),
|
|
30
|
+
Animated.timing(opacity, {
|
|
31
|
+
toValue: 0,
|
|
32
|
+
duration: 300,
|
|
33
|
+
useNativeDriver: true,
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
animation.start(() => onHide());
|
|
37
|
+
return () => {
|
|
38
|
+
animation.stop();
|
|
39
|
+
};
|
|
40
|
+
}, [duration, opacity, onHide]);
|
|
41
|
+
return (_jsxs(Animated.View, { style: [styles.container, { opacity }], children: [_jsx(View, { style: styles.iconContainer, children: getIcon() }), _jsxs(View, { style: styles.textContainer, children: [_jsx(Text, { style: styles.message, children: message }), description && _jsx(Text, { style: styles.description, children: description }), type === "alert_info" && (_jsx(View, { style: styles.footerButton, children: _jsx(Button, { label: "Entendi", variant: "primary", size: "medium", onPress: onHide }) }))] })] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CreateToastStylesProps } from "./toast.types";
|
|
2
|
+
export declare function useToastStyles(data: CreateToastStylesProps): {
|
|
3
|
+
container: any;
|
|
4
|
+
iconContainer: {
|
|
5
|
+
marginRight: number;
|
|
6
|
+
};
|
|
7
|
+
textContainer: {
|
|
8
|
+
flex: number;
|
|
9
|
+
};
|
|
10
|
+
message: any;
|
|
11
|
+
description: any;
|
|
12
|
+
footerButton: {
|
|
13
|
+
marginTop: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=toast.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.styles.d.ts","sourceRoot":"","sources":["../../../src/components/toast/toast.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;;;;;;;;;;;;EAyD1D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Dimensions, StyleSheet } from "react-native";
|
|
2
|
+
export function useToastStyles(data) {
|
|
3
|
+
const mapCustomStylesToType = {
|
|
4
|
+
alert_info: {
|
|
5
|
+
container: {
|
|
6
|
+
paddingVertical: 50,
|
|
7
|
+
paddingHorizonral: 24,
|
|
8
|
+
top: Dimensions.get("screen").height * 0.4,
|
|
9
|
+
},
|
|
10
|
+
message: {
|
|
11
|
+
textAlign: "center",
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const stylesToType = (data === null || data === void 0 ? void 0 : data.type) && (mapCustomStylesToType === null || mapCustomStylesToType === void 0 ? void 0 : mapCustomStylesToType[data === null || data === void 0 ? void 0 : data.type]);
|
|
19
|
+
return StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
position: "absolute",
|
|
22
|
+
top: 60,
|
|
23
|
+
left: 16,
|
|
24
|
+
right: 16,
|
|
25
|
+
backgroundColor: "white",
|
|
26
|
+
borderRadius: 8,
|
|
27
|
+
padding: 16,
|
|
28
|
+
flexDirection: "row",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
shadowColor: "#000",
|
|
31
|
+
shadowOffset: { width: 0, height: 2 },
|
|
32
|
+
shadowOpacity: 0.25,
|
|
33
|
+
shadowRadius: 3.84,
|
|
34
|
+
elevation: 5,
|
|
35
|
+
...stylesToType === null || stylesToType === void 0 ? void 0 : stylesToType.container,
|
|
36
|
+
},
|
|
37
|
+
iconContainer: {
|
|
38
|
+
marginRight: 12,
|
|
39
|
+
},
|
|
40
|
+
textContainer: {
|
|
41
|
+
flex: 1,
|
|
42
|
+
},
|
|
43
|
+
message: {
|
|
44
|
+
fontSize: 16,
|
|
45
|
+
fontWeight: "600",
|
|
46
|
+
marginBottom: 4,
|
|
47
|
+
...stylesToType === null || stylesToType === void 0 ? void 0 : stylesToType.message,
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
fontSize: 14,
|
|
51
|
+
color: "#666",
|
|
52
|
+
...stylesToType === null || stylesToType === void 0 ? void 0 : stylesToType.description,
|
|
53
|
+
},
|
|
54
|
+
footerButton: {
|
|
55
|
+
marginTop: 40,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ShowToastParams {
|
|
2
|
+
message: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
type?: "success" | "error" | "info" | "warning" | "alert_info";
|
|
5
|
+
duration?: number;
|
|
6
|
+
}
|
|
7
|
+
export type CreateToastStylesProps = {
|
|
8
|
+
type: ShowToastParams["type"];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=toast.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.types.d.ts","sourceRoot":"","sources":["../../../src/components/toast/toast.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|