forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBc35a83aBurak Boduroğlu4 months ago440 commits

page-header.tsx61 lines, 1.7 KiBHistoryRawDownload
1import type { JSX, ParentProps } from "solid-js";
2import { Show } from "solid-js";
3import { cn } from "@/lib/cn";
4
5export function PageHeader(
6 props: ParentProps<{
7 eyebrow?: string;
8 title: string;
9 description?: string;
10 actions?: JSX.Element;
11 class?: string;
12 /** Compact greeting strip (dashboard). */
13 compact?: boolean;
14 }>,
15) {
16 return (
17 <div
18 class={cn(
19 "rounded-xl border border-border/60 bg-card text-card-foreground shadow-sm",
20 props.class,
21 )}
22 >
23 <div
24 class={cn(
25 "flex flex-col sm:flex-row sm:items-center sm:justify-between",
26 props.compact
27 ? "gap-3 px-4 py-3 sm:px-5 sm:py-3.5"
28 : "gap-4 px-4 py-4 sm:px-5 sm:py-5",
29 )}
30 >
31 <div class={cn("min-w-0", props.compact ? "space-y-0.5" : "max-w-2xl space-y-1")}>
32 <Show when={props.eyebrow && !props.compact}>
33 <p class="text-xs font-medium text-muted-foreground">{props.eyebrow}</p>
34 </Show>
35 <h1
36 class={cn(
37 "font-semibold tracking-tight",
38 props.compact ? "text-lg sm:text-xl" : "text-xl sm:text-2xl",
39 )}
40 >
41 {props.title}
42 </h1>
43 <Show when={props.description}>
44 <p
45 class={cn(
46 "text-muted-foreground",
47 props.compact ? "text-xs sm:text-sm" : "text-sm",
48 )}
49 >
50 {props.description}
51 </p>
52 </Show>
53 {props.children}
54 </div>
55 <Show when={props.actions}>
56 <div class="flex shrink-0 flex-wrap items-center gap-2">{props.actions}</div>
57 </Show>
58 </div>
59 </div>
60 );
61}