import { Box, Card, Link, Stack, useContainerSize, } from "@front10/base-elements"; import clsx from "clsx"; import { cover } from "polished"; import * as React from "react"; import { InstagramCardProps } from "./InstagramCard"; import InstagramCardPostTypeCarouselIcon from "./InstagramCardPostTypeCarouselIcon"; import InstagramCardPostTypeVideoIcon from "./InstagramCardPostTypeVideoIcon"; import { InstagramImage } from "./InstagramImage"; export interface Props extends InstagramCardProps { hoverBgColor?: string; breakpoint?: number; } function InstagramSquare( { data: { image, imageAltText = "", text1: likesCount, text2: commentsCount, text3: captionText, link, type, imageFull, } = {}, showText1 = true, showText2 = true, imageCover = "cover", onCardClick, onCallToActionClick, tabIndex, className, isLoading, hoverBgColor = "rgba(0,0,0,0.8)", children, breakpoint = 300, ...props }: Props, ref: React.Ref ) { const cardWidth = useContainerSize(ref as any); return ( ({ position: "relative", width: "100%", ...theme.layout?.cardContainer, minHeight: "fit-content", "&:hover": { ".fr-card-body": { opacity: "1", visibility: "visible", pointerEvents: "all", }, ".fr-icon-type-post": { opacity: "0", }, "@media (hover: none) and (pointer: coarse)": { ".fr-card-body": { display: "none", }, }, }, })} className={clsx("wx-card", className)} > {cardWidth > 180 && type === "video" && ( )} {cardWidth > 180 && type === "carousel" && ( )} {children && cardWidth > breakpoint && (likesCount || commentsCount || captionText) && ( {children} )} ); } const InstagramSquareWithRef = React.forwardRef(InstagramSquare); export { InstagramSquareWithRef as InstagramSquare };