Skip to content

Commit a4bab72

Browse files
committed
Refactor ItemList and ProfilesDetails components for improved layout and author display
1 parent f0a46b3 commit a4bab72

File tree

2 files changed

+46
-55
lines changed

2 files changed

+46
-55
lines changed

src/components/ItemList/ItemList.tsx

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,69 +24,65 @@ const ItemList = ({ data, onOpenDetails, handleCopyToClipboard, itemToShow }: It
2424
onPress={() => onOpenDetails(item)}
2525
isFooterBlurred
2626
shadow="sm"
27-
className="md:w-[850px]"
27+
className="md:w-[580px]"
2828
>
2929
<CardBody className="flex flex-row flex-wrap p-0 sm:flex-nowrap h-[260px] overflow-hidden w-full">
3030
<Image
31-
removeWrapper
31+
isBlurred
3232
alt={item.title}
3333
radius="sm"
3434
src={item.logo}
3535
className="w-full h-full flex-none object-cover object-center md:w-72"
3636
/>
37-
<div className="px-4 py-5 flex-1">
38-
<div className="flex items-center justify-between mb-2">
39-
<h3 className="text-large font-medium">{item.title}</h3>
40-
<Tooltip content="Copy to clipboard" color="primary">
41-
<Button
42-
color="primary"
43-
radius="sm"
44-
size="sm"
45-
variant="shadow"
46-
onPress={() =>
47-
handleCopyToClipboard(
48-
item.content || 'Dont have content'
49-
)
50-
}
51-
>
52-
Copy
53-
</Button>
54-
</Tooltip>
55-
</div>
56-
<Divider />
57-
<div className="flex flex-wrap gap-3 pt-2 text-small text-default-400">
58-
<p>
59-
{item.description.length > 150
60-
? `${item.description.substring(0, 200)}...`
61-
: item.description}
62-
</p>
37+
<div className="px-4 py-5 flex-1 flex flex-col justify-between">
38+
<div>
39+
<div className="flex items-center justify-between mb-2">
40+
<h3 className="text-large font-medium">{item.title}</h3>
41+
<Tooltip content="Copy to clipboard" color="primary">
42+
<Button
43+
color="primary"
44+
radius="sm"
45+
size="sm"
46+
variant="shadow"
47+
onPress={() =>
48+
handleCopyToClipboard(
49+
item.content || 'Dont have content'
50+
)
51+
}
52+
>
53+
Copy
54+
</Button>
55+
</Tooltip>
56+
</div>
57+
<Divider />
58+
<h3 className="text-small text-default-400 mt-2">
59+
By: {item.author}
60+
</h3>
6361
</div>
64-
<div className="flex flex-col">
65-
<div className="flex flex-wrap gap-3 pt-2">
62+
<div className="flex flex-col pt-2 text-small text-default-400">
63+
<div className="flex flex-wrap">
6664
{item.class.map &&
6765
item.class.map((className: string, index: number) => (
68-
<Chip
69-
avatar={
70-
className === 'All' ? (
71-
<GroupIcon />
72-
) : (
73-
<Avatar
74-
name={item.title}
75-
src={classIcon[className]}
76-
/>
77-
)
78-
}
66+
<div
7967
key={index}
80-
color="warning"
81-
variant="dot"
82-
size="sm"
83-
className="my-1"
68+
className="bg-default-300/20 rounded-md h-auto w-auto gap-2 p-1 m-1 transition-transform duration-300 ease-in-out hover:translate-x-2"
8469
>
85-
{className}
86-
</Chip>
70+
{className === 'All' ? (
71+
<GroupIcon
72+
className="w-3 h-3 text-tiny"
73+
aria-label="All classes"
74+
/>
75+
) : (
76+
<Avatar
77+
key={index}
78+
name={className}
79+
src={classIcon[className]}
80+
className="w-5 h-5 text-tiny"
81+
/>
82+
)}
83+
</div>
8784
))}
8885
</div>
89-
9086
<div className="flex flex-wrap gap-2">
9187
{item.tags.map((tag: string, index: number) => (
9288
<Chip

src/components/ProfilesDetails/ProfilesDetails.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const ProfilesDetails = ({ data, isOpen, onOpenChange }: ProfilesDetailsProps) =
101101
<GroupIcon />
102102
) : (
103103
<Avatar
104-
name={data.title}
104+
name={className}
105105
src={classIcon[className]}
106106
/>
107107
)
@@ -120,12 +120,7 @@ const ProfilesDetails = ({ data, isOpen, onOpenChange }: ProfilesDetailsProps) =
120120
<p className="font-bold">Roles:</p>
121121
{data.roles.map((role: string, index: number) => (
122122
<Chip
123-
avatar={
124-
<Avatar
125-
name={data.title}
126-
src={roleIcon[role]}
127-
/>
128-
}
123+
avatar={<Avatar name={role} src={roleIcon[role]} />}
129124
key={index}
130125
color="warning"
131126
variant="dot"

0 commit comments

Comments
 (0)