mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Use global drag and drop hint overlay
This commit is contained in:
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>;
|
||||
}
|
||||
Reference in new issue
Block a user