| 29 | * Page title + lede aligned with the Create Agent flow. |
| 30 | */ |
| 31 | export function PageHeader({ |
| 32 | titleId, |
| 33 | title, |
| 34 | description, |
| 35 | afterTitle, |
| 36 | end, |
| 37 | className, |
| 38 | titleClassName, |
| 39 | isMonospaceTitle, |
| 40 | }: PageHeaderProps) { |
| 41 | const hasEnd = end != null; |
| 42 | |
| 43 | return ( |
| 44 | <header |
| 45 | className={cn( |
| 46 | "mb-10", |
| 47 | hasEnd |
| 48 | ? "flex max-w-none flex-col gap-6 sm:flex-row sm:items-end sm:justify-between" |
| 49 | : "max-w-2xl", |
| 50 | className, // e.g. override margin with `mb-8` |
| 51 | )} |
| 52 | > |
| 53 | <div className="min-w-0 flex-1"> |
| 54 | <div className="flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-4 sm:gap-y-2"> |
| 55 | <h1 |
| 56 | id={titleId} |
| 57 | className={cn( |
| 58 | pageTitleTextClass, |
| 59 | isMonospaceTitle && "font-mono text-xl sm:text-2xl [overflow-wrap:anywhere] break-words", |
| 60 | titleClassName, |
| 61 | )} |
| 62 | translate={isMonospaceTitle ? "no" : undefined} |
| 63 | > |
| 64 | {title} |
| 65 | </h1> |
| 66 | {afterTitle} |
| 67 | </div> |
| 68 | {description != null && description !== false ? ( |
| 69 | <div className="mt-2 max-w-2xl text-pretty text-sm leading-relaxed text-muted-foreground [&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs [&_kbd]:font-mono [&_kbd]:text-xs"> |
| 70 | {description} |
| 71 | </div> |
| 72 | ) : null} |
| 73 | </div> |
| 74 | {end ? <div className="flex w-full min-w-0 flex-col gap-3 sm:w-auto sm:shrink-0 sm:items-end">{end}</div> : null} |
| 75 | </header> |
| 76 | ); |
| 77 | } |