Skip to content

Commit bad5f31

Browse files
Merge pull request #127 from sadiksaifi/feat/repo-card-redesign
feat(#121): add new design for repo-cards, closes #121, closes #118
2 parents c47b081 + adf4a96 commit bad5f31

File tree

1 file changed

+58
-47
lines changed

1 file changed

+58
-47
lines changed

components/Card.tsx

Lines changed: 58 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,32 @@ function Card({ repo }: Props) {
1010
return (
1111
<div className="shadow-sm card bg-2023-void-2 ring-1 ring-2023-manga-3">
1212
<div className="relative card-body">
13-
<div className="avatar">
14-
<div className="w-10 h-10 mb-2 rounded-full">
15-
<a
16-
href={repo.owner.html_url}
17-
title={repo.owner.login}
18-
target="_blank"
19-
rel="noreferrer"
20-
>
21-
<img
22-
src={repo.owner.avatar_url}
23-
width={50}
24-
height={50}
25-
alt={repo.owner.login}
26-
className="rounded-xl"
27-
/>
28-
</a>
29-
</div>
13+
<div className="flex gap-4 items-center justify-start">
14+
<a
15+
className="border-2 rounded-full h-14 aspect-square p-1 border-neutral-100"
16+
href={repo.owner.html_url}
17+
title={repo.owner.login}
18+
target="_blank"
19+
rel="noreferrer"
20+
>
21+
<img
22+
src={repo.owner.avatar_url}
23+
alt={repo.owner.login}
24+
className="rounded-full"
25+
/>
26+
</a>
27+
<a
28+
href={repo.html_url}
29+
title={repo.name}
30+
target="_blank"
31+
rel="noreferrer"
32+
className="text-3xl cursor-pointer hover:underline text-2023-bavarian-gold-2 whitespace-nowrap overflow-hidden text-ellipsis max-w-full"
33+
>
34+
{repo.name}
35+
</a>
3036
</div>
3137

32-
<a
33-
href={repo.html_url}
34-
title={repo.name}
35-
target="_blank"
36-
rel="noreferrer"
37-
className={`text-3xl card-title link link-hover text-2023-bavarian-gold-2`}
38-
>
39-
{repo.name}
40-
</a>
41-
42-
<p className="mb-2 text-neutral-100">{emojify(repo.description)}</p>
38+
<p className="my-2 text-neutral-300">{emojify(repo.description)}</p>
4339

4440
<div className="card-actions">
4541
{repo.topics.map((topic: string) => (
@@ -59,29 +55,44 @@ function Card({ repo }: Props) {
5955
))}
6056
</div>
6157

62-
<div className="items-end justify-center h-full card-actions">
63-
<div className="shadow stats bg-transparent ring-1 ring-2023-manga-2">
64-
<div className="stat">
65-
<div className="text-center stat-title items-center inline-flex">
66-
<GoStar color="rgb(163 163 163 / var(--tw-text-opacity))"/>{' '}
67-
<span className="ml-0.5 text-neutral-400">Stars</span>
68-
</div>
69-
<div className="text-center stat-value text-neutral-400">
58+
{/* stars and forks cards */}
59+
<div className="w-full flex gap-3 xl:gap-5 text-neutral-100 cursor-pointer mt-6">
60+
<a
61+
href={`${repo.html_url}/stargazers`}
62+
target="_blank"
63+
className="group w-full border rounded-xl p-3 xl:px-4 flex items-center gap-2 xl:gap-3 relative"
64+
>
65+
<GoStar className="text-yellow-200 text-2xl" />
66+
<div className="flex flex-col">
67+
<div className="xl:text-2xl text-lg font-semibold">
7068
{repo.stargazers_count}
7169
</div>
70+
<div className="text-neutral-400 text-xs lg:text-sm">Stars</div>
7271
</div>
73-
</div>
74-
<div className="shadow stats bg-transparent ring-1 ring-2023-manga-2">
75-
<div className="stat">
76-
<div className="text-center stat-title items-center inline-flex">
77-
<GoRepoForked color="rgb(163 163 163 / var(--tw-text-opacity))" />{' '}
78-
<span className="ml-0.5 text-neutral-400">Forks</span>
79-
</div>
80-
<div className="text-center stat-value text-neutral-400">
81-
{repo.forks}
82-
</div>
72+
<div
73+
id="tooltip"
74+
className="hidden group-hover:block absolute bg-2023-void-2 text-2023-bavarian-gold-2 px-2 py-1 rounded-md"
75+
>
76+
Checkout all the stars here!
77+
</div>
78+
</a>
79+
<a
80+
href={`${repo.html_url}/forks`}
81+
target="_blank"
82+
className="group w-full border rounded-xl p-3 flex items-center gap-3 relative"
83+
>
84+
<GoRepoForked className="text-yellow-200 text-2xl" />
85+
<div className="flex flex-col">
86+
<div className="text-2xl font-semibold">{repo.forks}</div>
87+
<div className="text-neutral-400 text-xs lg:text-sm">Forks</div>
88+
</div>
89+
<div
90+
id="tooltip"
91+
className="hidden group-hover:block absolute bg-2023-void-2 text-2023-bavarian-gold-2 px-2 py-1 rounded-md"
92+
>
93+
Checkout all the forks here!
8394
</div>
84-
</div>
95+
</a>
8596
</div>
8697
</div>
8798
</div>

0 commit comments

Comments
 (0)