hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { Show, type JSX, type ParentProps } from "solid-js"; |
| 2 | import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; |
| 3 | import { cn } from "@/lib/cn"; |
| 4 | |
| 5 | /** |
| 6 | * The card every list page sits in: title, description and header actions, |
| 7 | * then the page's toolbar and content. It matches the header DataTable draws, |
| 8 | * so card-grid pages (classes, courses, boards…) read the same as table pages. |
| 9 | * |
| 10 | * Like DataTable, the title is not drawn: the shell already names the page |
| 11 | * (the header on desktop, its own h1 on phones), and a second copy read as a |
| 12 | * duplicate heading. It still labels the section for assistive tech. |
| 13 | */ |
| 14 | export function DataSection( |
| 15 | props: ParentProps<{ title?: string; description?: string; actions?: JSX.Element; class?: string }>, |
| 16 | ) { |
| 17 | return ( |
| 18 | <section aria-label={props.title} class={cn("data-shell space-y-4 p-4 [&_.empty-state]:border-0 [&_.empty-state]:bg-transparent", props.class)}> |
| 19 | <Show when={props.description || props.actions}> |
| 20 | <div class="flex flex-wrap items-start justify-between gap-3"> |
| 21 | <div class="min-w-0"> |
| 22 | <Show when={props.description}> |
| 23 | <p class="text-sm text-muted-foreground">{props.description}</p> |
| 24 | </Show> |
| 25 | </div> |
| 26 | <Show when={props.actions}> |
| 27 | {/* Header actions are toolbar controls too: the same pill and height |
| 28 | as a DataTable toolbar, never a taller h-9 button of their own. */} |
| 29 | <div class={cn("flex min-w-0 flex-wrap items-center gap-2", TOOLBAR_SLOT)}>{props.actions}</div> |
| 30 | </Show> |
| 31 | </div> |
| 32 | </Show> |
| 33 | {props.children} |
| 34 | </section> |
| 35 | ); |
| 36 | } |