Skip to content

Commit 60a3f5d

Browse files
committed
fix(web): clickable links in cart bio + legible hero text on any cover
- Bio now auto-links http(s) URLs (clickable) on the public cart page. - Hero title/bio/handle were cream over a weak scrim → invisible on light covers (in the preview and on mobile). Strengthen the bottom scrim (ink/90→ink/10) and add a text shadow so they stay readable on any cover; same fix in the editor live preview.
1 parent 173ba8d commit 60a3f5d

3 files changed

Lines changed: 33 additions & 8 deletions

File tree

web/app/(public)/c/[slug]/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ProductCard } from "@/components/product-card";
66
import { RevealOnScroll } from "@/components/reveal-on-scroll";
77
import { StickyShareBar } from "@/components/sticky-share-bar";
88
import { CartCover } from "@/components/cart-cover";
9+
import { linkify } from "@/lib/linkify";
910

1011
export const dynamic = "force-dynamic";
1112

@@ -40,14 +41,15 @@ export default async function PublicCartPage({ params }: { params: { slug: strin
4041
priority
4142
sizes="100vw"
4243
/>
43-
<div className="absolute inset-0 bg-gradient-to-t from-ink/80 via-ink/30 to-transparent" />
44-
<div className="absolute inset-x-0 bottom-0 px-5 sm:px-6 pb-6 sm:pb-10 max-w-3xl mx-auto text-cream">
44+
{/* Stronger bottom scrim so cream text stays legible on light covers. */}
45+
<div className="absolute inset-0 bg-gradient-to-t from-ink/90 via-ink/55 to-ink/10" />
46+
<div className="absolute inset-x-0 bottom-0 px-5 sm:px-6 pb-6 sm:pb-10 max-w-3xl mx-auto text-cream [text-shadow:0_1px_10px_rgba(0,0,0,0.55)]">
4547
<div className="flex items-center gap-2 mb-2 sm:mb-3">
46-
<Image src={cart.ownerAvatarUrl} alt="" width={32} height={32} className="rounded-full border border-cream/30" unoptimized />
47-
<span className="text-sm opacity-90">@{cart.ownerHandle}</span>
48+
<Image src={cart.ownerAvatarUrl} alt="" width={32} height={32} className="rounded-full border border-cream/40" unoptimized />
49+
<span className="text-sm font-medium">@{cart.ownerHandle}</span>
4850
</div>
4951
<h1 className="font-serif text-3xl sm:text-5xl leading-[1.05] mb-2 sm:mb-3">{cart.title}</h1>
50-
{cart.bio && <p className="text-sm sm:text-base opacity-90 max-w-xl leading-relaxed">{cart.bio}</p>}
52+
{cart.bio && <p className="text-sm sm:text-base text-cream/95 max-w-xl leading-relaxed">{linkify(cart.bio)}</p>}
5153
</div>
5254
</section>
5355

web/app/dashboard/carts/[id]/editor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ function PreviewCartPage({ cart }: { cart: Cart }) {
352352
<div style={{ ["--accent" as string]: cart.accentHex } as React.CSSProperties}>
353353
<div className="relative aspect-[5/4]">
354354
<CartCover coverImageUrl={cart.coverImageUrl} accentHex={cart.accentHex} title={cart.title} />
355-
<div className="absolute inset-0 bg-gradient-to-t from-ink/70 via-ink/20 to-transparent" />
356-
<div className="absolute bottom-3 left-3 right-3 text-cream">
357-
<p className="text-xs opacity-90">@{cart.ownerHandle}</p>
355+
<div className="absolute inset-0 bg-gradient-to-t from-ink/90 via-ink/55 to-ink/10" />
356+
<div className="absolute bottom-3 left-3 right-3 text-cream [text-shadow:0_1px_8px_rgba(0,0,0,0.55)]">
357+
<p className="text-xs font-medium">@{cart.ownerHandle}</p>
358358
<p className="font-serif text-xl leading-tight">{cart.title}</p>
359359
</div>
360360
</div>

web/lib/linkify.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
3+
const URL_RE = /(https?:\/\/[^\s]+)/g;
4+
5+
// Render free text with any http(s) URLs turned into clickable links.
6+
// Safe inside server components; not for use inside another <a>.
7+
export function linkify(text: string): React.ReactNode[] {
8+
return text.split(URL_RE).map((part, i) =>
9+
/^https?:\/\//.test(part) ? (
10+
<a
11+
key={i}
12+
href={part}
13+
target="_blank"
14+
rel="noopener noreferrer"
15+
className="underline underline-offset-2 break-words hover:opacity-80"
16+
>
17+
{part}
18+
</a>
19+
) : (
20+
<React.Fragment key={i}>{part}</React.Fragment>
21+
),
22+
);
23+
}

0 commit comments

Comments
 (0)