style: improve text wrapping and overflow handling in components

- Enhanced text wrapping and overflow handling in BreadcrumbsBase, ItemCard, PageHeader, Show (Products), and Show (Recipes) components for better responsiveness and readability.
This commit is contained in:
Jérémy Munsch 2026-11-04 09:56:24 +01:00
parent e55889369b
commit 522cf7a87e
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
5 changed files with 33 additions and 13 deletions

View file

@ -25,21 +25,23 @@ export default function BreadcrumbsBase({
<BreadcrumbList>
{breadcrumbs.map((breadcrumb, breadcrumbIndex) => (
<ul
key={breadcrumb.url}
className="flex flex-wrap items-center gap-1 break-words sm:gap-2.5"
key={`${breadcrumb.url}-${breadcrumbIndex}`}
className="flex flex-wrap items-center gap-1 break-words [overflow-wrap:anywhere] sm:gap-2.5 min-w-0 max-w-full"
>
{breadcrumbIndex >= 1 && <BreadcrumbSeparator />}
<BreadcrumbItem className="text-primary-foreground/70">
<BreadcrumbItem className="text-primary-foreground/70 min-w-0 break-words [overflow-wrap:anywhere] inline">
{breadcrumbIndex !== breadcrumbs.length - 1 &&
breadcrumb.url ? (
<Link
href={breadcrumb.url}
className="rounded-md text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
className="rounded-md text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 break-words [overflow-wrap:anywhere]"
>
{breadcrumb.title}
</Link>
) : (
breadcrumb.title
<span className="break-words [overflow-wrap:anywhere]">
{breadcrumb.title}
</span>
)}
</BreadcrumbItem>
</ul>

View file

@ -56,14 +56,20 @@ export default function ItemCard({
<div className="w-full mt-6 text-center px-10 md:px-0 flex flex-col flex-1 items-center">
{title?.text && (
<h4 className={cn("text-3xl md:text-3xl", titleFont, titleWeight)}>
<h4
className={cn(
"text-3xl md:text-3xl break-words [overflow-wrap:anywhere] max-w-full",
titleFont,
titleWeight,
)}
>
{title.text}
</h4>
)}
{subtitle?.text && (
<h5
className={cn(
"text-2xl",
"text-2xl break-words [overflow-wrap:anywhere] max-w-full",
subtitle?.font ?? fonts.DELIUS_SWASH,
subtitle?.weight ?? "font-normal",
)}

View file

@ -17,10 +17,22 @@ export default function PageHeader(props: PageHeaderProps) {
containerClassName="space-y-0 md:px-4"
>
<Breadcrumbs />
<h1 className={cn("uppercase text-4xl font-bold mt-4", title.font)}>
<h1
className={cn(
"uppercase text-4xl font-bold mt-4 break-words [overflow-wrap:anywhere]",
title.font,
)}
>
{title.text}
</h1>
<p className={cn("mt-4", description.font)}>{description.text}</p>
<p
className={cn(
"mt-4 break-words [overflow-wrap:anywhere]",
description.font,
)}
>
{description.text}
</p>
</Section>
);
}

View file

@ -151,8 +151,8 @@ export default function Show({
<div className="flex flex-col lg:flex-row gap-8 lg:gap-24 items-start">
{/* Left Column: Info */}
<div className="flex-1 space-y-6 w-full">
<h1 className="text-start text-3xl sm:text-4xl md:text-5xl font-bold text-primary-foreground uppercase tracking-tight">
<div className="flex-1 space-y-6 w-full min-w-0">
<h1 className="text-start text-3xl sm:text-4xl md:text-5xl font-bold text-primary-foreground uppercase tracking-tight break-words [overflow-wrap:anywhere]">
{product.name}
</h1>

View file

@ -187,8 +187,8 @@ export default function Show({
<div className="flex flex-col lg:flex-row gap-8 lg:gap-24 items-start">
{/* Left Column: Info */}
<div className="flex-1 space-y-5 w-full">
<h1 className="text-start text-3xl sm:text-4xl md:text-5xl font-bold text-primary-foreground uppercase tracking-tight">
<div className="flex-1 space-y-5 w-full min-w-0">
<h1 className="text-start text-3xl sm:text-4xl md:text-5xl font-bold text-primary-foreground uppercase tracking-tight break-words [overflow-wrap:anywhere]">
{recipe.name}
</h1>