# transcription/ui/components/cards.py
from contextlib import contextmanager

from nicegui import ui


@contextmanager
def archival_card(title: str | None = None, extra_classes: str = ""):
    """Reusable container for Flat 2.0 Bento Grid cards."""
    with ui.card().classes(f"w-full ui-card-surface p-4 {extra_classes}") as card:
        if title:
            ui.label(title.upper()).classes(
                "text-xs font-bold ui-text-muted tracking-wider mb-3 ui-header-divider pb-1"
            )
        yield card