Fa riempire tutta la larghezza alle tab di Campionato.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan CacciariandCursor committed 2026-09-07 18:35:35 +02:00
1 parent 8e23f31685
commit fc65914f55
2 files changed
+11 -3

No files matched your search

+10 -3
View File
@@ -27,10 +27,13 @@ export function BarraSottosezioni({
voci, voci,
defaultId, defaultId,
variante = "pillole", variante = "pillole",
riempiLarghezza = false,
}: { }: {
voci: VoceSottosezione[]; voci: VoceSottosezione[];
defaultId?: string; defaultId?: string;
variante?: "pillole" | "sottolineatura"; variante?: "pillole" | "sottolineatura";
/** Tab a larghezza uguale che riempiono la barra (es. Campionato). */
riempiLarghezza?: boolean;
}) { }) {
const [attiva, setAttiva] = useState(defaultId ?? voci[0]?.id ?? ""); const [attiva, setAttiva] = useState(defaultId ?? voci[0]?.id ?? "");
const direzione = useRef(0); const direzione = useRef(0);
@@ -80,7 +83,10 @@ export function BarraSottosezioni({
role="tablist" role="tablist"
aria-label="Sottosezioni" aria-label="Sottosezioni"
className={cn( className={cn(
"flex w-max min-w-full flex-nowrap", "flex flex-nowrap",
riempiLarghezza
? "w-full"
: "w-max min-w-full",
sottolineatura ? "gap-1 px-2 py-1.5" : "snap-x snap-mandatory gap-1.5 px-5", sottolineatura ? "gap-1 px-2 py-1.5" : "snap-x snap-mandatory gap-1.5 px-5",
)} )}
> >
@@ -100,7 +106,8 @@ export function BarraSottosezioni({
vaiA(i); vaiA(i);
}} }}
className={cn( className={cn(
"min-h-11 shrink-0 touch-manipulation whitespace-nowrap text-sm font-bold uppercase tracking-wide transition-colors", "min-h-11 touch-manipulation whitespace-nowrap text-sm font-bold uppercase tracking-wide transition-colors",
riempiLarghezza ? "min-w-0 flex-1" : "shrink-0",
sottolineatura sottolineatura
? cn( ? cn(
"rounded-xl px-1 py-2.5 text-center", "rounded-xl px-1 py-2.5 text-center",
@@ -114,7 +121,7 @@ export function BarraSottosezioni({
? "bg-accent text-accent-foreground shadow-pop" ? "bg-accent text-accent-foreground shadow-pop"
: "bg-secondary text-muted-foreground", : "bg-secondary text-muted-foreground",
), ),
)} )}
> >
{v.label} {v.label}
</button> </button>
+1
View File
@@ -85,6 +85,7 @@ function Classifica() {
<BarraSottosezioni <BarraSottosezioni
defaultId={tab ?? "classifica"} defaultId={tab ?? "classifica"}
variante="sottolineatura" variante="sottolineatura"
riempiLarghezza
voci={[ voci={[
{ {
id: "classifica", id: "classifica",