Open History to see the last commit
1import type { ReactNode } from "react";
2import type { LucideIcon } from "lucide-react";
3
4import { cn } from "~/lib/utils";
5
6export function TimelineSystemDivider(props: {
7 readonly label: string;
8 readonly detail?: ReactNode | null;
9 readonly tone?: "neutral" | "danger";
10 readonly icon?: LucideIcon;
11 readonly actionLabel?: string;
12 readonly onAction?: () => void;
13}) {
14 const Icon = props.icon;
15 const content = (
16 <>
17 {Icon ? <Icon className="size-3 shrink-0" /> : null}
18 <span className="font-medium">{props.label}</span>
19 {props.detail ? <span className="max-w-80 truncate opacity-70">· {props.detail}</span> : null}
20 </>
21 );
22
23 return (
24 <div
25 className={cn(
26 "flex min-w-0 items-center gap-2 py-2 text-[11px] text-muted-foreground",
27 props.tone === "danger" && "text-destructive",
28 )}
29 >
30 <span aria-hidden="true" className="h-px flex-1 bg-border/70" />
31 {props.onAction ? (
32 <button
33 type="button"
34 aria-label={props.actionLabel}
35 onClick={props.onAction}
36 className="flex min-w-0 items-center gap-1.5 rounded-full border border-border/70 bg-background px-2.5 py-1 transition-colors hover:bg-muted"
37 title={props.actionLabel}
38 >
39 {content}
40 </button>
41 ) : (
42 <span className="flex min-w-0 items-center gap-1.5 rounded-full px-2 py-1">{content}</span>
43 )}
44 <span aria-hidden="true" className="h-px flex-1 bg-border/70" />
45 </div>
46 );
47}