2020-08-26 08:34:01 +00:00
|
|
|
import React from "react";
|
|
|
|
import DragAndDrop from "./";
|
|
|
|
import Text from "../text";
|
|
|
|
|
2021-03-03 15:09:00 +00:00
|
|
|
export default {
|
|
|
|
title: "Components/DragAndDrop",
|
|
|
|
component: DragAndDrop,
|
|
|
|
argTypes: {
|
2021-03-07 11:57:26 +00:00
|
|
|
onDrop: { action: "onDrop" },
|
2021-03-03 15:09:00 +00:00
|
|
|
targetFile: { action: "File: ", table: { disable: true } },
|
2021-03-07 11:57:26 +00:00
|
|
|
onMouseDown: { action: "onMouseDown" },
|
2021-03-03 15:09:00 +00:00
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
description: {
|
2021-03-07 11:57:26 +00:00
|
|
|
component: `Drag And Drop component can be used as Dropzone.
|
2021-03-03 15:09:00 +00:00
|
|
|
|
2021-03-07 11:57:26 +00:00
|
|
|
See documentation: https://github.com/react-dropzone/react-dropzone
|
2021-03-03 15:09:00 +00:00
|
|
|
`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const Template = (args) => {
|
|
|
|
const onDrop = (items) => {
|
|
|
|
args.onDrop(items);
|
|
|
|
for (let file of items) {
|
|
|
|
if (file) {
|
|
|
|
args.targetFile(file.name);
|
2020-08-26 08:34:01 +00:00
|
|
|
}
|
2021-03-03 15:09:00 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const dropDownStyles = { margin: 16, width: 200, height: 200 };
|
|
|
|
const textStyles = { textAlign: "center", lineHeight: "9.5em" };
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DragAndDrop {...args} isDropZone onDrop={onDrop} style={dropDownStyles}>
|
|
|
|
<Text style={textStyles} color="#999" fontSize="20px">
|
|
|
|
Drop items here
|
|
|
|
</Text>
|
|
|
|
</DragAndDrop>
|
|
|
|
);
|
|
|
|
};
|
2020-08-26 08:34:01 +00:00
|
|
|
|
2021-03-03 15:09:00 +00:00
|
|
|
export const Default = Template.bind({});
|