Use global drag and drop hint overlay

This commit is contained in:
Danielv123 committed 2024-05-04 20:31:36 +02:00
1 parent 920b5c1655
commit c34a13b3e4
6 files changed
+149 -167

No files matched your search

@@ -0,0 +1,20 @@
import { useContext } from "react";
import { Button } from "antd";
import { InboxOutlined, UploadOutlined } from "@ant-design/icons";
import { DraggingContext } from "../model/is_dragging";
export default function UploadButton(props: React.ComponentProps<typeof Button>) {
const isDroppingFile = useContext(DraggingContext);
return <Button
{...props}
style={{
...props.style,
// Distinct border when dropping file
border: isDroppingFile ? "dashed 2px rgb(22, 119, 255)" : undefined,
}}
icon={isDroppingFile ? <InboxOutlined /> : props.icon || <UploadOutlined />}
>
{props.children || "Upload"}
</Button>;
}