mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
36 lines
1.1 KiB
CoffeeScript
36 lines
1.1 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'}>
|
|
<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 className="file-action-icon" onClick={@_onClickRemove}>
|
|
<RetinaImg name="remove-attachment.png" mode={RetinaImg.Mode.ContentDark} />
|
|
</div>
|
|
</Flexbox>
|
|
</div>
|
|
</div>
|
|
|
|
_onClickRemove: (event) =>
|
|
event.preventDefault()
|
|
Actions.removeAttachment @props.upload
|
|
|
|
_extension: =>
|
|
path.extname(@props.upload.filename)[1..-1]
|
|
|
|
module.exports = FileUpload
|