Skip to content

Commit 1d48eca

Browse files
committed
fix: use client avatar on home
1 parent f1ce025 commit 1d48eca

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/app/clients/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,23 @@ export default function ClientsPage() {
2121
</p>
2222

2323
<div className="mt-14 grid grid-cols-1 gap-5 md:grid-cols-2">
24-
{allClients.map((client) => (
24+
{allClients.map((client, idx) => (
2525
<Link
2626
key={client.slug}
2727
href={`/clients/${client.slug}`}
2828
className="group relative flex min-h-52 flex-col justify-end overflow-clip rounded-lg"
2929
>
3030
{client.banner ? (
3131
<>
32-
<Image src={client.banner} alt="" fill className="object-cover" />
32+
<Image
33+
src={client.banner}
34+
alt=""
35+
fill
36+
sizes="(max-width: 768px) 100vw, 50vw"
37+
className="object-cover"
38+
loading={idx < 2 ? "eager" : "lazy"}
39+
priority={idx < 2}
40+
/>
3341
<div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/30" />
3442
</>
3543
) : client.brand ? (

src/app/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { allClients } from "@/lib/content";
1111
import { NAV_SOCIALS } from "@/lib/data/layout";
1212
import { PROJECTS } from "@/lib/data/projects";
1313
import { cn } from "@/lib/utils";
14+
import { ClientAvatar } from "@/components/client/client-avatar";
1415

1516
export const metadata: Metadata = {
1617
description:
@@ -88,9 +89,7 @@ export default function HomePage() {
8889
i < 3 && "border-b border-border/50"
8990
)}
9091
>
91-
{client.avatar && (
92-
<Image src={client.avatar} alt="" width={20} height={20} className="size-5 shrink-0 rounded" />
93-
)}
92+
<ClientAvatar client={client} alt="Client avatar" className="size-5 shrink-0 rounded" />
9493
<span className="font-medium">{client.name}</span>
9594
<span className="text-muted-foreground">{client.role}</span>
9695
<MdArrowOutward className="ml-auto size-4 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100" />

src/components/client/client-avatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ClientAvatar: React.FC<ClientAvatarProps> = ({ client, className, .
1616
className={cn("flex items-center justify-center bg-(--client-background)", className)}
1717
style={{ "--client-background": client.brand.background } as React.CSSProperties}
1818
>
19-
<Image src={client.avatar} className="p-2" {...props} />
19+
<Image src={client.avatar} className="p-[20%]" {...props} />
2020
</div>
2121
);
2222
}

0 commit comments

Comments
 (0)