const getFileTypeIcon = require('./getFileTypeIcon') const FilePreview = require('./FilePreview') const { h, Component } = require('preact') module.exports = class FileCard extends Component { constructor (props) { super(props) this.meta = {} this.tempStoreMetaOrSubmit = this.tempStoreMetaOrSubmit.bind(this) this.renderMetaFields = this.renderMetaFields.bind(this) this.handleSave = this.handleSave.bind(this) this.handleCancel = this.handleCancel.bind(this) } tempStoreMetaOrSubmit (ev) { const file = this.props.files[this.props.fileCardFor] if (ev.keyCode === 13) { ev.stopPropagation() ev.preventDefault() this.props.saveFileCard(this.meta, file.id) return } const value = ev.target.value const name = ev.target.dataset.name this.meta[name] = value } renderMetaFields (file) { const metaFields = this.props.metaFields || [] return metaFields.map((field) => { return
}) } handleSave (ev) { const fileID = this.props.fileCardFor this.props.saveFileCard(this.meta, fileID) } handleCancel (ev) { this.meta = {} this.props.toggleFileCard() } render () { const file = this.props.files[this.props.fileCardFor] return