Skip to content

Commit d3683a8

Browse files
committed
add description to collection details
1 parent b32c66b commit d3683a8

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

packages/grant-explorer/src/features/collections/CollectionDetails.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { CheckIcon, LinkIcon } from "@heroicons/react/20/solid";
33
import { ShoppingCartIcon } from "@heroicons/react/24/outline";
44
import { useState } from "react";
55
import { CollectionV1 } from "./collections";
6+
import { useCollections } from "./hooks/useCollections";
67

78
type Props = {
89
collection: CollectionV1;
@@ -17,17 +18,21 @@ export function CollectionDetails({
1718
projectsInView,
1819
onAddAllApplicationsToCart,
1920
}: Props) {
21+
const collections = useCollections();
22+
23+
// filter collections by collection.href
24+
const description = collections.data?.find(
25+
(c) => c.cid && location.href.includes(c.cid)
26+
)?.description;
27+
2028
return (
2129
<div className="mt-16">
22-
<h3 className="text-4xl font-medium mb-2">{`${
23-
collection.name ?? defaultCollectionName
24-
} (${projectsInView})`}</h3>
25-
<div className="flex">
26-
<div className="text-lg flex-1 whitespace-pre-wrap">
27-
{collection.description}
28-
</div>
29-
<div className="w-96">
30-
<div className="flex justify-end gap-2">
30+
<div className="flex flex-col gap-12">
31+
<div className="flex flex-col md:flex-row justify-between items-start md:items-center">
32+
<h3 className="text-4xl font-medium">
33+
{`${collection.name ?? defaultCollectionName} (${projectsInView})`}
34+
</h3>
35+
<div className="flex gap-2 mt-4 md:mt-0">
3136
<ShareButton url={location.href} />
3237
<AddToCartButton
3338
current={projectsInView}
@@ -36,6 +41,9 @@ export function CollectionDetails({
3641
/>
3742
</div>
3843
</div>
44+
<div className="text-lg flex-1 whitespace-pre-wrap">
45+
{description ?? collection.description}
46+
</div>
3947
</div>
4048
</div>
4149
);

0 commit comments

Comments
 (0)