Files
NapCatQQ/.pnpm-store/v3/files/ce/d8af532259818045e971a809d11113b09104eaf6a51ac2c3edc02aa8d13c7e8436e5a539788fbafe5f1a4000cdce189aa90f8faa61e51ad36cc1d3f44f6d07
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

54 lines
1.2 KiB
Plaintext

import React from "react";
import Dropzone from "../../";
import { FileWithPath } from "file-selector";
export default class Basic extends React.Component {
state = { files: [] };
onDrop = (files: FileWithPath[]) => {
this.setState({
files,
});
};
render() {
return (
<section>
<div className="dropzone">
<Dropzone onDrop={this.onDrop}>
{({ getRootProps, getInputProps }) => (
<div {...getRootProps()}>
<input {...getInputProps()} />
<p>
Try dropping some files here, or click to select files to
upload.
</p>
</div>
)}
</Dropzone>
</div>
<aside>
<h2>Dropped files</h2>
<ul>
{this.state.files.map((f) => (
<li key={f.name}>
{f.name} - {f.size} bytes
</li>
))}
</ul>
</aside>
</section>
);
}
}
export const optional = (
<Dropzone>
{({ getRootProps, getInputProps }) => (
<div {...getRootProps()}>
<input {...getInputProps()} />
</div>
)}
</Dropzone>
);