dograh/ui/src/components/flow/nodes/BaseNode.tsx

29 lines
889 B
TypeScript
Raw Normal View History

2025-09-09 14:37:32 +05:30
import { forwardRef, HTMLAttributes } from "react";
import { cn } from "@/lib/utils";
export const BaseNode = forwardRef<
HTMLDivElement,
HTMLAttributes<HTMLDivElement> & {
selected?: boolean;
invalid?: boolean;
2025-11-05 15:22:46 +05:30
highlighted?: boolean;
2025-09-09 14:37:32 +05:30
}
2025-11-05 15:22:46 +05:30
>(({ className, selected, invalid, highlighted, ...props }, ref) => (
2025-09-09 14:37:32 +05:30
<div
ref={ref}
className={cn(
"relative rounded-md border bg-card p-5 text-card-foreground min-w-[300px] min-h-[100px]",
className,
selected ? "border-muted-foreground shadow-lg" : "",
invalid ? "border-red-500 shadow-[0_0_10px_rgba(239,68,68,0.5)]" : "",
2025-11-05 15:22:46 +05:30
highlighted ? "ring-2 ring-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.5)]" : "",
2025-09-09 14:37:32 +05:30
"hover:ring-1",
)}
tabIndex={0}
{...props}
/>
));
BaseNode.displayName = "BaseNode";