Files
sendou.ink/app/components/elements/Section.tsx
Kalle 0a4518a0e2
Some checks failed
E2E Tests / e2e (push) Has been cancelled
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled
Tournament multi step + grouped and early end SE/DE (#3449)
2026-10-09 18:38:25 +03:00

42 lines
1.0 KiB
TypeScript

import clsx from "clsx";
import type { LucideIcon } from "lucide-react";
import styles from "./Section.module.css";
/** Card-like container used to group related content, with an optional header row of title, action and icon. */
export function SendouSection({
title,
icon: Icon,
action,
gap = "md",
className,
children,
}: {
title?: string;
icon?: LucideIcon;
/** Rendered at the end of the header row, e.g. a "Show all" button. Only shown together with `title`. */
action?: React.ReactNode;
/** Space between the header and the content. */
gap?: "md" | "lg";
className?: string;
children: React.ReactNode;
}) {
return (
<section
className={clsx(
styles.section,
{ [styles.gapLg]: gap === "lg" },
className,
)}
>
{title ? (
<header className={styles.header}>
<h2 className={styles.title}>{title}</h2>
{action ? <div className={styles.action}>{action}</div> : null}
{Icon ? <Icon className={styles.icon} size={16} /> : null}
</header>
) : null}
{children}
</section>
);
}