import React, { useState } from 'react';
import { Upload, Button, Icon } from '@btri-ui/base';
import { UploadFile, UploadProps } from 'antd';

export default () => {
  const [fileList, setFileList] = useState<UploadFile[]>([]);

  const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) =>
    setFileList(newFileList);

  return (
    <>
      <Upload
        action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
        fileList={fileList}
        onChange={handleChange}
      >
        <Button type="primary" icon={<Icon iconName="Export"></Icon>}>
          点击上传
        </Button>
      </Upload>
    </>
  );
};
