diff --git a/src/webapp/features/collections/components/collectionCardPreview/CollectionCardPreview.tsx b/src/webapp/features/collections/components/collectionCardPreview/CollectionCardPreview.tsx index 5a674406..79a40f61 100644 --- a/src/webapp/features/collections/components/collectionCardPreview/CollectionCardPreview.tsx +++ b/src/webapp/features/collections/components/collectionCardPreview/CollectionCardPreview.tsx @@ -1,4 +1,14 @@ -import { AspectRatio, Card, Center, Grid, Text, Image } from '@mantine/core'; +import { + AspectRatio, + Card, + Center, + Group, + Text, + Image, + Box, + ScrollAreaAutosize, +} from '@mantine/core'; +import { useScroller } from '@mantine/hooks'; import useCollection from '../../lib/queries/useCollection'; import { useState } from 'react'; @@ -7,7 +17,10 @@ interface Props { handle: string; } +const CARD_WIDTH = 120; + export default function CollectionCardPreview(props: Props) { + const scroller = useScroller(); const [imageError, setImageError] = useState(false); const { data } = useCollection({ @@ -21,35 +34,45 @@ export default function CollectionCardPreview(props: Props) { if (cards.length === 0) return null; return ( - - {cards.map((c) => ( - - {c.cardContent.imageUrl && !imageError ? ( - - {`${c.cardContent.url} setImageError(true)} - /> - - ) : ( - - -
- - {c.cardContent.title ?? - c.cardContent.description ?? - c.cardContent.url} - -
-
-
- )} -
- ))} -
+ + 2} wrap="nowrap"> + {cards.map((c) => ( + + {c.cardContent.imageUrl && !imageError ? ( + + {`${c.cardContent.url} setImageError(true)} + /> + + ) : ( + + +
+ + {c.cardContent.title ?? + c.cardContent.description ?? + c.cardContent.url} + +
+
+
+ )} +
+ ))} +
+
); } diff --git a/src/webapp/features/collections/components/collectionCardPreview/Skeleton.CollectionCardPreview.tsx b/src/webapp/features/collections/components/collectionCardPreview/Skeleton.CollectionCardPreview.tsx index 186823c2..0e6032e2 100644 --- a/src/webapp/features/collections/components/collectionCardPreview/Skeleton.CollectionCardPreview.tsx +++ b/src/webapp/features/collections/components/collectionCardPreview/Skeleton.CollectionCardPreview.tsx @@ -1,15 +1,25 @@ -import { AspectRatio, Grid, GridCol, Skeleton } from '@mantine/core'; +import { AspectRatio, Box, Group, Skeleton } from '@mantine/core'; + +const CARD_WIDTH = 120; export default function CollectionCardPreviewSkeleton() { return ( - - {Array.from({ length: 4 }).map((_, i) => ( - - - - - - ))} - + + + {Array.from({ length: 4 }).map((_, i) => ( + + + + + + ))} + + ); }