import { AspectRatio, Card, Center, Group, Text, Image, Box, } from '@mantine/core'; import { useScroller } from '@mantine/hooks'; import useCollection from '../../lib/queries/useCollection'; import { useState } from 'react'; interface Props { rkey: string; handle: string; } const CARD_WIDTH = 130; export default function CollectionCardPreview(props: Props) { const scroller = useScroller(); const [imageError, setImageError] = useState(false); const { data } = useCollection({ rkey: props.rkey, handle: props.handle, limit: 6, }); const cards = data?.pages.flatMap((col) => col.urlCards) ?? []; if (cards.length === 0) return null; return ( 2} wrap="nowrap"> {cards.map((c) => ( {c.cardContent.imageUrl && !imageError ? ( {`${c.cardContent.url} setImageError(true)} /> ) : (
{c.cardContent.title ?? c.cardContent.description ?? c.cardContent.url}
)}
))}
); }