add empty table placeholders

This commit is contained in:
Abel Luck 2026-03-30 15:28:56 +02:00
parent 8716579508
commit 0803617e62
5 changed files with 60 additions and 6 deletions

View file

@ -190,6 +190,7 @@ def table_section(
eyebrow: str | None = None,
title: str,
subtitle: str | None = None,
empty_message: str,
headers: tuple[str, ...],
rows: tuple[tuple[Node, ...], ...],
actions: Node | None = None,
@ -208,6 +209,17 @@ def table_section(
),
]
body_rows: Node
if rows:
body_rows = (render_row(row) for row in rows)
else:
body_rows = h.tr[
h.td(
colspan=str(len(headers)),
class_="px-4 py-8 text-center text-sm text-slate-500 sm:px-6",
)[empty_message]
]
return h.section[
h.div(class_="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between")[
h.div[
@ -238,9 +250,7 @@ def table_section(
)
]
],
h.tbody(class_="divide-y divide-slate-200 bg-white")[
(render_row(row) for row in rows)
],
h.tbody(class_="divide-y divide-slate-200 bg-white")[body_rows],
]
]
],