@@ -3,6 +3,7 @@ import { CheckIcon, LinkIcon } from "@heroicons/react/20/solid";
3
3
import { ShoppingCartIcon } from "@heroicons/react/24/outline" ;
4
4
import { useState } from "react" ;
5
5
import { CollectionV1 } from "./collections" ;
6
+ import { useCollections } from "./hooks/useCollections" ;
6
7
7
8
type Props = {
8
9
collection : CollectionV1 ;
@@ -17,17 +18,21 @@ export function CollectionDetails({
17
18
projectsInView,
18
19
onAddAllApplicationsToCart,
19
20
} : 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
+
20
28
return (
21
29
< 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" >
31
36
< ShareButton url = { location . href } />
32
37
< AddToCartButton
33
38
current = { projectsInView }
@@ -36,6 +41,9 @@ export function CollectionDetails({
36
41
/>
37
42
</ div >
38
43
</ div >
44
+ < div className = "text-lg flex-1 whitespace-pre-wrap" >
45
+ { description ?? collection . description }
46
+ </ div >
39
47
</ div >
40
48
</ div >
41
49
) ;
0 commit comments