'use client' import { useState } from 'react' import { cn } from '@sim/emcn' interface DropZoneProps { onDrop: (e: React.DragEvent) => void children: React.ReactNode className?: string } /** File drop target with a dashed accent overlay while dragging. Shared by the * whitelabeling settings and the deploy-as-block icon upload. */ export function DropZone({ onDrop, children, className }: DropZoneProps) { const [isDragging, setIsDragging] = useState(false) return (
{ if (e.dataTransfer.types.includes('Files')) { e.preventDefault() setIsDragging(true) } }} onDragLeave={(e) => { if (!e.currentTarget.contains(e.relatedTarget as Node)) { setIsDragging(false) } }} onDrop={(e) => { setIsDragging(false) onDrop(e) }} > {children} {isDragging && (
)}
) }