import { type ReactNode } from "react"; import { Link } from "@/lib/router"; import { cn } from "../lib/utils"; interface EntityRowProps { leading?: ReactNode; identifier?: string; title: string; subtitle?: string; /** * Optional metadata columns rendered immediately after the title. When set, * the title stops flex-growing and a spacer is inserted between `meta` and * `trailing`, so meta sits next to the name while trailing stays pinned right. */ meta?: ReactNode; trailing?: ReactNode; selected?: boolean; to?: string; onClick?: () => void; className?: string; titleClassName?: string; reserveSubtitleSpace?: boolean; } export function EntityRow({ leading, identifier, title, subtitle, meta, trailing, selected, to, onClick, className, titleClassName, reserveSubtitleSpace, }: EntityRowProps) { const isClickable = !!(to || onClick); const classes = cn( "flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors", isClickable && "cursor-pointer hover:bg-accent/50", selected && "bg-accent/30", className ); const content = ( <> {leading &&
{subtitle}
)}