@datlv-trustshop/shopify-inapp-components 0.1.22 → 0.1.23
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.
|
@@ -36,6 +36,9 @@ interface FloatingCardProps {
|
|
|
36
36
|
onDismiss?: () => void;
|
|
37
37
|
onPrimaryAction?: (data: FloatingCardData) => void;
|
|
38
38
|
onSecondaryAction?: (data: FloatingCardData) => void;
|
|
39
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
40
|
+
animationType?: 'slide' | 'fade';
|
|
41
|
+
showCloseButton?: boolean;
|
|
39
42
|
}
|
|
40
43
|
export declare const FloatingCard: React.FC<FloatingCardProps>;
|
|
41
44
|
export default FloatingCard;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Card, BlockStack, InlineStack, Text, Badge, Button, Box, } from "@shopify/polaris";
|
|
3
3
|
import { XIcon } from "@shopify/polaris-icons";
|
|
4
|
-
export const FloatingCard = ({ data, onDismiss, onPrimaryAction, onSecondaryAction, }) => {
|
|
4
|
+
export const FloatingCard = ({ data, onDismiss, onPrimaryAction, onSecondaryAction, position = 'bottom-right', showCloseButton = true, }) => {
|
|
5
5
|
const handlePrimaryAction = () => {
|
|
6
6
|
if (data.primary_action) {
|
|
7
7
|
const url = data.primary_action.url;
|
|
@@ -40,7 +40,8 @@ export const FloatingCard = ({ data, onDismiss, onPrimaryAction, onSecondaryActi
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
// Don't apply inline styles - let CSS handle positioning
|
|
44
|
+
return (_jsx("div", { className: `floating-card floating-card-${position}`, children: _jsxs(Card, { padding: "0", roundedAbove: "sm", children: [(showCloseButton && data.dismissible !== false) && (_jsx("button", { className: "floating-card-close", onClick: onDismiss, "aria-label": "Close", children: _jsx(XIcon, {}) })), _jsxs(BlockStack, { gap: "0", children: [data.img_url && (_jsx("div", { className: "floating-card-image-container", children: _jsx("img", { src: data.img_url, alt: data.image_alt || data.title, style: {
|
|
44
45
|
width: "100%",
|
|
45
46
|
height: "100%",
|
|
46
47
|
objectFit: "cover",
|