@@ -5,55 +5,43 @@ import { FiPlus } from "react-icons/fi";
5
5
import { RiDeleteBinLine } from "react-icons/ri" ;
6
6
import Text from "components/atoms/Typography/text" ;
7
7
import Tooltip from "components/atoms/Tooltip/tooltip" ;
8
+ import { useFetchListContributors } from "lib/hooks/useList" ;
8
9
import StackedAvatar , { Contributor } from "../StackedAvatar/stacked-avatar" ;
9
10
10
11
interface ListCardProps {
11
12
list : DbUserList ;
12
13
}
13
14
const ListCard = ( { list } : ListCardProps ) => {
14
- const dummyContributorsCount = 105 ;
15
- const dummyContributors : Contributor [ ] = [
16
- {
17
- host_login : "bdougie" ,
18
- } ,
19
- {
20
- host_login : "brandonroberts" ,
21
- } ,
22
- {
23
- host_login : "ritadee" ,
24
- } ,
25
- {
26
- host_login : "ogdev-01" ,
27
- } ,
28
- {
29
- host_login : "jpmcb" ,
30
- } ,
31
- {
32
- host_login : "divyanshu013" ,
33
- } ,
34
- ] ;
15
+ const { data : contributors } = useFetchListContributors ( list . id ) ;
16
+
17
+ const contributorsAvatar : Contributor [ ] = contributors ?. map ( ( contributor ) => ( {
18
+ host_login : contributor . login ,
19
+ } ) ) ;
20
+
21
+ const dummyContributorsCount = contributors ?. length ?? 0 ;
22
+
35
23
return (
36
24
< div >
37
- < div className = "flex flex-col items-start w-full gap-4 px-4 py-5 bg-white rounded-lg md:items-center md:justify-between md:flex-row lg:px-8 lg:gap-2" >
25
+ < div className = "flex flex-col items-start w-full gap-4 px-4 py-6 bg-white rounded-lg md:items-center md:justify-between md:flex-row lg:px-8 lg:gap-2" >
38
26
< div className = "flex flex-col flex-1 gap-4 lg:gap-6" >
39
27
< div className = "flex items-center gap-4 lg:items-center " >
40
28
< div className = "w-4 h-4 rounded-full bg-light-orange-10" > </ div >
41
29
< div className = "flex justify-between text-xl text-light-slate-12" >
42
- < Link href = { `/list/ ${ list . user . login } /${ list . id } /overview` } > { list . name } </ Link >
30
+ < Link href = { `/lists /${ list . id } /overview` } > { list . name } </ Link >
43
31
</ div >
44
32
< div className = "px-2 border rounded-2xl text-light-slate-11" > { ! ! list . is_public ? "public" : "private" } </ div >
45
33
</ div >
46
34
</ div >
47
35
< div className = "" >
48
36
< div className = "flex items-center justify-end w-full gap-8" >
49
37
{ /* Contributors section */ }
50
- < div className = "flex flex-col flex-1 gap-2 mr-2" >
38
+ < div className = "flex flex-col items-center flex-1 gap-1 mr-2" >
51
39
< span className = "text-xs text-light-slate-11" > Contributors</ span >
52
- < Text className = "flex items-center text-xl " > { dummyContributorsCount } </ Text >
40
+ < Text className = "flex items-center text-2xl " > { dummyContributorsCount } </ Text >
53
41
</ div >
54
42
55
43
< div className = "flex items-center" >
56
- < StackedAvatar contributors = { dummyContributors } visibleQuantity = { 6 } classNames = "scale-125" />
44
+ < StackedAvatar contributors = { contributorsAvatar } visibleQuantity = { 6 } classNames = "scale-125" />
57
45
< Tooltip content = "Add more contributors" >
58
46
< button
59
47
className = "z-50 w-8 h-8 overflow-hidden scale-110 bg-white border-2 border-white rounded-full"
@@ -67,15 +55,14 @@ const ListCard = ({ list }: ListCardProps) => {
67
55
</ div >
68
56
< div className = "justify-end flex-1 hidden md:flex" >
69
57
{ /* Delete button */ }
70
- < button type = "button" >
71
- < span className = " bg-light-slate-1 inline-block rounded-lg p-2.5 border mr-2 cursor-pointer" >
72
- < RiDeleteBinLine title = "Edit Insight Page" className = "text-lg text-light-slate-10" />
73
- </ span >
58
+ < button className = "inline-block p-3 mr-2 border rounded-lg cursor-pointer bg-light-slate-1" type = "button" >
59
+ < RiDeleteBinLine title = "Edit Insight Page" className = "text-lg text-light-slate-10" />
74
60
</ button >
75
- < Link href = { `/list/${ list . user . login } /${ list . id } /overview` } >
76
- < span className = " bg-light-slate-1 inline-block rounded-lg p-2.5 border cursor-pointer" >
77
- < MdOutlineArrowForwardIos title = "Go To Insight Page" className = "text-lg text-light-slate-10" />
78
- </ span >
61
+ < Link
62
+ className = "inline-block p-3 mr-2 border rounded-lg cursor-pointer bg-light-slate-1"
63
+ href = { `/lists/${ list . id } /overview` }
64
+ >
65
+ < MdOutlineArrowForwardIos title = "Go To Insight Page" className = "text-lg text-light-slate-10" />
79
66
</ Link >
80
67
</ div >
81
68
</ div >
0 commit comments