import React from "react"; import { Button } from "../../button"; import { FloatingImageCardProps } from "./types"; import { DEFAULT_BUTTON_ANIMATION_TYPE } from "@shared/components/animation-wrapper"; import { NextImage } from "@shared/components/next-image"; import { Text } from "@shared/components/text"; import { cx } from "@shared/utils"; const alignmentClasses: Record = { left: "flex w-full justify-start", right: "flex w-full justify-end", center: "flex w-full justify-center", }; export const FloatingImageCard: React.FC = ({ card, lgWidth, mdWidth, }) => { const { image, title, header, body, cta, ctaAlignment, imageLink, imageClassName, className, isPromoBarImg = false, shadow = false, disableAnimation, } = card; const ctaAlignmentClass = ctaAlignment ? alignmentClasses[ctaAlignment] : alignmentClasses.left; const imageLinkAvailableClass = imageLink ? "cursor-pointer" : ""; const handleImageClick = imageLink ? () => { if (typeof window !== "undefined") { window.open(imageLink, "_blank"); } } : undefined; if (isPromoBarImg) { return image?.href ? ( ) : null; } return (
{image?.href ? (
) : null} {header ? ( {header} ) : null} {body ? ( {body} ) : null}
{cta ? (
); }; export default FloatingImageCard;