| 86 | } |
| 87 | |
| 88 | const buildDragImage = (target: HTMLElement) => { |
| 89 | const icon = target.querySelector('[data-component="file-icon"]') ?? target.querySelector("svg") |
| 90 | const text = target.querySelector("span") |
| 91 | if (!icon || !text) return |
| 92 | |
| 93 | const image = document.createElement("div") |
| 94 | image.className = |
| 95 | "flex items-center gap-x-2 px-2 py-1 bg-surface-raised-base rounded-md border border-border-base text-12-regular text-text-strong" |
| 96 | image.style.position = "absolute" |
| 97 | image.style.top = "-1000px" |
| 98 | image.innerHTML = (icon as SVGElement).outerHTML + (text as HTMLSpanElement).outerHTML |
| 99 | return image |
| 100 | } |
| 101 | |
| 102 | const withFileDragImage = (event: DragEvent) => { |
| 103 | const image = buildDragImage(event.currentTarget as HTMLElement) |