Spaces:
Sleeping
Sleeping
File size: 1,249 Bytes
05c5ed5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import { cn } from "lib/utils";
import { TriangleAlertIcon, VariableIcon, XIcon } from "lucide-react";
export function VariableMentionItem({
nodeName,
path,
notFound,
onRemove,
className,
type,
}: {
nodeName: string;
path: string[];
notFound?: boolean;
onRemove?: () => void;
className?: string;
type?: string;
}) {
return (
<div
className={cn(
notFound ? "hover:ring-destructive" : "hover:ring-blue-500",
"ring ring-border gap-1 flex items-center text-xs px-2 py-1 rounded-sm bg-background",
className,
)}
>
{notFound ? (
<TriangleAlertIcon className="text-destructive size-2.5" />
) : (
<VariableIcon className="text-blue-500 size-2.5" />
)}
{type ? (
<span className="text-muted-foreground text-xs">{type}</span>
) : null}
<span>{nodeName}/</span>
<span
className={cn(
notFound ? "text-destructive" : "text-blue-500",
"min-w-0 truncate flex-1",
)}
>
{path.join(".")}
</span>
{onRemove ? (
<XIcon
className="text-muted-foreground size-2.5 cursor-pointer"
onClick={onRemove}
/>
) : null}
</div>
);
}
|