Mailspring/internal_packages/composer/lib/file-upload.cjsx

41 lines
1.2 KiB
CoffeeScript

path = require 'path'
React = require 'react'
{RetinaImg, Flexbox} = require 'nylas-component-kit'
{Utils,
Actions,
FileUploadStore} = require 'nylas-exports'
class FileUpload extends React.Component
@displayName: 'FileUpload'
render: =>
<div className="file-wrap file-upload">
<div className="inner">
<Flexbox direction="row" style={alignItems: 'center'}>
<div className="file-info-wrap">
<RetinaImg className="file-icon"
fallback="file-fallback.png"
mode={RetinaImg.Mode.ContentPreserve}
name="file-#{@_extension()}.png"/>
<span className="file-name">
<span className="uploading">{@props.upload.filename}</span>
</span>
</div>
<div className="file-action-icon" onClick={@_onClickRemove}>
<RetinaImg
name="remove-attachment.png"
mode={RetinaImg.Mode.ContentIsMask}
/>
</div>
</Flexbox>
</div>
</div>
_onClickRemove: (event) =>
event.preventDefault()
Actions.removeAttachment @props.upload
_extension: =>
path.extname(@props.upload.filename.toLowerCase())[1..-1]
module.exports = FileUpload