forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

data-section.tsx32 lines, 1.3 KiBHistoryRawDownload
1import { Show, type JSX, type ParentProps } from "solid-js";
2import { cn } from "@/lib/cn";
3
4/**
5 * The card every list page sits in: title, description and header actions,
6 * then the page's toolbar and content. It matches the header DataTable draws,
7 * so card-grid pages (classes, courses, boards…) read the same as table pages.
8 */
9export function DataSection(
10 props: ParentProps<{ title?: string; description?: string; actions?: JSX.Element; class?: string }>,
11) {
12 return (
13 <section class={cn("data-shell space-y-4 p-4 [&_.empty-state]:border-0 [&_.empty-state]:bg-transparent", props.class)}>
14 <Show when={props.title || props.description || props.actions}>
15 <div class="flex flex-wrap items-start justify-between gap-3">
16 <div class="min-w-0">
17 <Show when={props.title}>
18 <h2 class="truncate text-lg font-semibold tracking-tight text-foreground">{props.title}</h2>
19 </Show>
20 <Show when={props.description}>
21 <p class="mt-1 text-sm text-muted-foreground">{props.description}</p>
22 </Show>
23 </div>
24 <Show when={props.actions}>
25 <div class="flex min-w-0 flex-wrap items-center gap-2 [&_button]:h-9 [&_button]:rounded-md">{props.actions}</div>
26 </Show>
27 </div>
28 </Show>
29 {props.children}
30 </section>
31 );
32}