The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { ComponentProps, ReactNode } from "react"; |
| 2 | |
| 3 | import { cn } from "../../lib/utils"; |
| 4 | |
| 5 | export function ThreadDetailsSection({ |
| 6 | headingId, |
| 7 | title, |
| 8 | actions, |
| 9 | separated = true, |
| 10 | showHeading = true, |
| 11 | children, |
| 12 | ...props |
| 13 | }: Omit<ComponentProps<"section">, "className" | "style" | "title" | "aria-labelledby"> & { |
| 14 | headingId: string; |
| 15 | title: string; |
| 16 | actions?: ReactNode; |
| 17 | separated?: boolean; |
| 18 | showHeading?: boolean; |
| 19 | }) { |
| 20 | return ( |
| 21 | <section |
| 22 | {...props} |
| 23 | aria-labelledby={showHeading ? headingId : undefined} |
| 24 | aria-label={showHeading ? undefined : title} |
| 25 | // A row can still render nothing (a fresh draft quiets Git actions), so an empty section |
| 26 | // collapses, and a divider only follows a section that has content. |
| 27 | className={cn( |
| 28 | "px-2 pt-2 pb-2.5 has-[>div:last-child:empty]:hidden", |
| 29 | separated && "border-border/65 [section:not(:has(>div:last-child:empty))~&]:border-t", |
| 30 | )} |
| 31 | > |
| 32 | <div |
| 33 | className={cn( |
| 34 | "mb-1 flex min-h-8 min-w-0 items-center justify-between gap-2 px-2.5", |
| 35 | !showHeading && "hidden", |
| 36 | )} |
| 37 | > |
| 38 | <h3 |
| 39 | id={headingId} |
| 40 | className="min-w-0 truncate text-2xs font-medium text-muted-foreground select-none" |
| 41 | > |
| 42 | {title} |
| 43 | </h3> |
| 44 | {actions ? <div className="flex shrink-0 items-center gap-1">{actions}</div> : null} |
| 45 | </div> |
| 46 | {children} |
| 47 | </section> |
| 48 | ); |
| 49 | } |