hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import type { JSX, ParentProps } from "solid-js"; |
| 2 | import { Show } from "solid-js"; |
| 3 | import { cn } from "@/lib/cn"; |
| 4 | |
| 5 | export 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 | "text-foreground", |
| 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 | ? "min-h-[66px] gap-3 py-1" |
| 28 | : "min-h-[66px] gap-4 py-1", |
| 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 |
| 39 | ? "text-xl leading-7 sm:text-[28px] sm:leading-9" |
| 40 | : "text-2xl leading-8 sm:text-[28px] sm:leading-9", |
| 41 | )} |
| 42 | > |
| 43 | {props.title} |
| 44 | </h1> |
| 45 | <Show when={props.description}> |
| 46 | <p |
| 47 | class={cn( |
| 48 | "text-muted-foreground", |
| 49 | props.compact ? "text-xs sm:text-sm" : "text-sm", |
| 50 | )} |
| 51 | > |
| 52 | {props.description} |
| 53 | </p> |
| 54 | </Show> |
| 55 | {props.children} |
| 56 | </div> |
| 57 | <Show when={props.actions}> |
| 58 | <div class="flex min-w-0 flex-wrap items-center gap-2">{props.actions}</div> |
| 59 | </Show> |
| 60 | </div> |
| 61 | </div> |
| 62 | ); |
| 63 | } |