Skip to content

Commit b485927

Browse files
committed
feat: use thumbnails
1 parent a3fbe5e commit b485927

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/components/stac/catalog.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Badge,
33
Heading,
44
HStack,
5+
SimpleGrid,
56
Skeleton,
67
Stack,
78
Text,
@@ -63,13 +64,15 @@ function Collections({
6364
<Heading size={"md"}>Collections</Heading>{" "}
6465
<Badge>{collections.length}</Badge>
6566
</HStack>
66-
{collections.map((collection) => (
67-
<CollectionCard
68-
collection={collection}
69-
setHref={setHref}
70-
key={collection.id}
71-
></CollectionCard>
72-
))}
67+
<SimpleGrid columns={{ base: 1, md: 2 }} gap={2}>
68+
{collections.map((collection) => (
69+
<CollectionCard
70+
collection={collection}
71+
setHref={setHref}
72+
key={collection.id}
73+
></CollectionCard>
74+
))}
75+
</SimpleGrid>
7376
</Stack>
7477
);
7578
}

src/components/stac/collection.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
DataList,
44
HStack,
55
IconButton,
6+
Image,
67
Stack,
78
Text,
89
} from "@chakra-ui/react";
@@ -56,6 +57,9 @@ export function CollectionCard({
5657
}) {
5758
const selfHref = getSelfHref(collection);
5859
const dispatch = useLayersDispatch();
60+
const thumbnail = Object.values(collection.assets || {}).find((asset) =>
61+
asset.roles?.includes("thumbnail")
62+
);
5963

6064
return (
6165
<Card.Root size={"sm"}>
@@ -64,8 +68,9 @@ export function CollectionCard({
6468
</Card.Header>
6569
<Card.Body>
6670
<Stack>
71+
{thumbnail && <Image src={thumbnail.href}></Image>}
6772
<Text lineClamp={3}>{collection.description}</Text>
68-
<DataList.Root orientation={"horizontal"}>
73+
<DataList.Root>
6974
<DataList.Item>
7075
<DataList.ItemLabel>Bounding box</DataList.ItemLabel>
7176
<DataList.ItemValue>

0 commit comments

Comments
 (0)