UNPKG

@makeen.io/material-ui-kit

Version:
36 lines (35 loc) 2.75 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";import _createClass from "@babel/runtime/helpers/createClass";import _inherits from "@babel/runtime/helpers/inherits";import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";function _createSuper(Derived) {var hasNativeReflectConstruct = _isNativeReflectConstruct();return function _createSuperInternal() {var Super = _getPrototypeOf(Derived),result;if (hasNativeReflectConstruct) {var NewTarget = _getPrototypeOf(this).constructor;result = Reflect.construct(Super, arguments, NewTarget);} else {result = Super.apply(this, arguments);}return _possibleConstructorReturn(this, result);};}function _isNativeReflectConstruct() {if (typeof Reflect === "undefined" || !Reflect.construct) return false;if (Reflect.construct.sham) return false;if (typeof Proxy === "function") return true;try {Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));return true;} catch (e) {return false;}}import React, { Component } from "react"; import "@uppy/core/dist/style.css"; import "@uppy/dashboard/dist/style.css"; import Uppy from "@uppy/core"; import { Dashboard } from "@uppy/react"; import Tus from "@uppy/tus";var AvatarPicker = /*#__PURE__*/function (_Component) {_inherits(AvatarPicker, _Component);var _super = _createSuper(AvatarPicker); function AvatarPicker() {var _this;_classCallCheck(this, AvatarPicker); _this = _super.apply(this, arguments); _this.state = { modalOpen: false }; _this.handleUploadModalOpen = function () {return _this.setState({ modalOpen: true });}; _this.handleUploadModalClose = function () {return _this.setState({ modalOpen: false });};return _this; }_createClass(AvatarPicker, [{ key: "componentWillUnmount", value: function componentWillUnmount() { this.uppy.close(); } }, { key: "render", value: function render() { // const { handleUploadCompleted } = this.props; this.uppy = Uppy({ meta: { type: "avatar" }, autoProceed: true }); this.uppy.use(Tus, { endpoint: "https://master.tus.io/files/" }); this.uppy.on("complete", function (result) { console.log("Completed upload, result:", result); // const id = result.successful[0].id; // const url = result.successful[0].uploadURL; // handleUploadCompleted(id, url); }); this.uppy.run(); return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/ React.createElement(Dashboard, { uppy: this.uppy, height: 200 })); } }]);return AvatarPicker;}(Component); export default AvatarPicker; //# sourceMappingURL=MuiFileUploader.js.map