hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; |
| 2 | import type { JSX, ParentProps } from "solid-js"; |
| 3 | import { Show } from "solid-js"; |
| 4 | import { cn } from "@/lib/cn"; |
| 5 | |
| 6 | export function PageHeader( |
| 7 | props: ParentProps<{ |
| 8 | eyebrow?: string; |
| 9 | title: string; |
| 10 | description?: string; |
| 11 | actions?: JSX.Element; |
| 12 | class?: string; |
| 13 | /** Compact greeting strip (dashboard). */ |
| 14 | compact?: boolean; |
| 15 | }>, |
| 16 | ) { |
| 17 | return ( |
| 18 | <div |
| 19 | class={cn( |
| 20 | "text-foreground", |
| 21 | props.class, |
| 22 | )} |
| 23 | > |
| 24 | <div |
| 25 | class={cn( |
| 26 | "flex flex-col sm:flex-row sm:items-center sm:justify-between", |
| 27 | props.compact |
| 28 | ? "min-h-[66px] gap-3 py-1" |
| 29 | : "min-h-[66px] gap-4 py-1", |
| 30 | )} |
| 31 | > |
| 32 | <div class={cn("min-w-0", props.compact ? "space-y-0.5" : "max-w-2xl space-y-1")}> |
| 33 | <Show when={props.eyebrow && !props.compact}> |
| 34 | <p class="text-xs font-medium text-muted-foreground">{props.eyebrow}</p> |
| 35 | </Show> |
| 36 | <h1 |
| 37 | class={cn( |
| 38 | "font-semibold tracking-tight", |
| 39 | props.compact |
| 40 | ? "text-xl leading-7 sm:text-[28px] sm:leading-9" |
| 41 | : "text-2xl leading-8 sm:text-[28px] sm:leading-9", |
| 42 | )} |
| 43 | > |
| 44 | {props.title} |
| 45 | </h1> |
| 46 | <Show when={props.description}> |
| 47 | <p |
| 48 | class={cn( |
| 49 | "text-muted-foreground", |
| 50 | props.compact ? "text-xs sm:text-sm" : "text-sm", |
| 51 | )} |
| 52 | > |
| 53 | {props.description} |
| 54 | </p> |
| 55 | </Show> |
| 56 | {props.children} |
| 57 | </div> |
| 58 | <Show when={props.actions}> |
| 59 | {/* Header actions follow the toolbar pill standard, so a page's |
| 60 | plain size="sm" buttons sit at the same height as its lists. */} |
| 61 | <div class={cn("flex min-w-0 flex-wrap items-center gap-2", TOOLBAR_SLOT)}>{props.actions}</div> |
| 62 | </Show> |
| 63 | </div> |
| 64 | </div> |
| 65 | ); |
| 66 | } |