@appbuckets/react-ui
Version:
Just Another React UI Framework
66 lines (60 loc) • 1.63 kB
JavaScript
;
var tslib = require('tslib');
var React = require('react');
var EmptyContent = require('../../EmptyContent/EmptyContent.js');
var Dropzone_context = require('../Dropzone.context.js');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(
n,
k,
d.get
? d
: {
enumerable: true,
get: function () {
return e[k];
},
}
);
}
});
}
n['default'] = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/ _interopNamespace(React);
/* --------
* Component Definition
* -------- */
var DropzoneHint = function (props) {
/** Get the Context */
var dropzone = Dropzone_context.useDropzone();
if (dropzone.files.length) {
return null;
}
// @ts-ignore
var icon = dropzone.state.isDragActive
? dropzone.props.iconOnDragging
: dropzone.props.iconOnIdle;
return React__namespace.createElement(
EmptyContent,
tslib.__assign({}, props, {
className: 'dropzone-hint',
icon: icon,
header: dropzone.props.hintTitle,
content: dropzone.isDisabled
? dropzone.props.hintWhileDisabled
: dropzone.state.isDragActive
? dropzone.props.hintWhileDragging
: dropzone.props.hintOnIdle,
})
);
};
DropzoneHint.displayName = 'DropzoneHint';
module.exports = DropzoneHint;