Alleggerisce Squadra e Classifica con sezioni a tendina e limita i prossimi eventi a 4.
Rimuove anche Scout Live dalle statistiche di squadra per snellire la schermata. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { statoMeta, type Stato } from "@/lib/crapp-data";
|
||||
import { Reveal } from "@/components/motion/Reveal";
|
||||
@@ -52,6 +53,43 @@ export function Section({
|
||||
);
|
||||
}
|
||||
|
||||
/** Sezione con titolo cliccabile: il contenuto si apre e chiude. `anteprima` resta sempre visibile. */
|
||||
export function SezioneTendina({
|
||||
titolo,
|
||||
children,
|
||||
anteprima,
|
||||
defaultAperta = false,
|
||||
indice = 0,
|
||||
}: {
|
||||
titolo: string;
|
||||
children: ReactNode;
|
||||
anteprima?: ReactNode;
|
||||
defaultAperta?: boolean;
|
||||
indice?: number;
|
||||
}) {
|
||||
const [aperta, setAperta] = useState(defaultAperta);
|
||||
return (
|
||||
<Reveal as="section" indice={indice} className="px-5 py-4">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAperta((v) => !v)}
|
||||
className="mb-3 flex w-full items-center justify-between gap-3 text-left active:scale-[0.99]"
|
||||
aria-expanded={aperta}
|
||||
>
|
||||
<h2 className="font-display text-lg uppercase tracking-wide">{titolo}</h2>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
"h-4 w-4 shrink-0 text-muted-foreground transition-transform",
|
||||
aperta && "rotate-180",
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
{anteprima}
|
||||
{aperta ? children : null}
|
||||
</Reveal>
|
||||
);
|
||||
}
|
||||
|
||||
export function StatoBadge({ stato, className }: { stato: Stato; className?: string }) {
|
||||
const meta = statoMeta[stato];
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user