Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ThreadDetailsSection.tsx

37 lines1.0 KB

1import type { ComponentProps, ReactNode } from "react";
2​
3import { cn } from "../../lib/utils";
4​
5/** Sections share header and content insets in both the sidebar and popover. */
6export function ThreadDetailsSection({
7 headingId,
8 title,
9 actions,
10 separated = 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}) {
19 return (
20 <section
21 {...props}
22 aria-labelledby={headingId}
23 className={cn("px-2 pt-2 pb-2.5", separated && "border-t border-border/65")}
24 >
25 <div className="mb-1 flex min-h-8 min-w-0 items-center justify-between gap-2 px-1.5">
26 <h3
27 id={headingId}
28 className="min-w-0 truncate text-[11px] font-medium text-muted-foreground select-none"
29 >
30 {title}
31 </h3>
32 {actions ? <div className="flex shrink-0 items-center gap-1">{actions}</div> : null}
33 </div>
34 {children}
35 </section>
36 );