UNPKG

@uppy/dashboard

Version:

Universal UI plugin for Uppy.

39 lines 1.31 kB
/* eslint-disable react/destructuring-assignment */ import { h } from 'preact'; import classNames from 'classnames'; function EditorPanel(props) { const file = props.files[props.fileCardFor]; const handleCancel = () => { props.uppy.emit('file-editor:cancel', file); props.closeFileEditor(); }; return h("div", { className: classNames('uppy-DashboardContent-panel', props.className), role: "tabpanel", "data-uppy-panelType": "FileEditor", id: "uppy-DashboardContent-panel--editor" }, h("div", { className: "uppy-DashboardContent-bar" }, h("div", { className: "uppy-DashboardContent-title", role: "heading", "aria-level": "1" }, props.i18nArray('editing', { file: h("span", { className: "uppy-DashboardContent-titleFile" }, file.meta ? file.meta.name : file.name) })), h("button", { className: "uppy-DashboardContent-back", type: "button", onClick: handleCancel }, props.i18n('cancel')), h("button", { className: "uppy-DashboardContent-save", type: "button", onClick: props.saveFileEditor }, props.i18n('save'))), h("div", { className: "uppy-DashboardContent-panelBody" }, props.editors.map(target => { return props.uppy.getPlugin(target.id).render(props.state); }))); } export default EditorPanel;