Correctly disable dropzone when host is offline

This commit is contained in:
Danielv123 committed 2024-05-18 10:27:40 +01:00
1 parent 05b697fd24
commit c6abe29e89
4 files changed
+22 -13

No files matched your search

@@ -6,13 +6,14 @@ import { DraggingContext } from "../model/is_dragging";
export default function UploadButton(props: React.ComponentProps<typeof Button>) {
const isDroppingFile = useContext(DraggingContext);
const borderColor = props.disabled ? "gray" : "rgb(22, 119, 255)";
return <Button
className="dropzone"
className={`dropzone ${props.disabled ? "disabled" : "enabled"}`}
{...props}
style={{
...props.style,
// Distinct border when dropping file
border: isDroppingFile ? "dashed 2px rgb(22, 119, 255)" : undefined,
border: isDroppingFile ? `dashed 2px ${borderColor}` : undefined,
}}
icon={isDroppingFile ? <InboxOutlined /> : props.icon || <UploadOutlined />}
>