2015-06-12 02:52:49 +08:00
|
|
|
path = require 'path'
|
|
|
|
React = require 'react'
|
|
|
|
FileUpload = require './file-upload'
|
2015-12-30 06:04:46 +08:00
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
2015-06-12 02:52:49 +08:00
|
|
|
|
|
|
|
class ImageFileUpload extends FileUpload
|
|
|
|
@displayName: 'ImageFileUpload'
|
|
|
|
|
|
|
|
@propTypes:
|
|
|
|
uploadData: React.PropTypes.object
|
|
|
|
|
|
|
|
render: =>
|
2015-07-16 04:15:05 +08:00
|
|
|
<div className="file-wrap file-image-wrap file-upload">
|
|
|
|
<div className="file-action-icon" onClick={@_onClickRemove}>
|
2015-12-30 06:04:46 +08:00
|
|
|
<RetinaImg name="image-cancel-button.png" mode={RetinaImg.Mode.ContentPreserve}/>
|
2015-06-18 07:03:50 +08:00
|
|
|
</div>
|
2015-06-12 02:52:49 +08:00
|
|
|
|
2015-07-16 04:15:05 +08:00
|
|
|
<div className="file-preview">
|
|
|
|
<div className="file-name-container">
|
2016-01-27 07:36:13 +08:00
|
|
|
<div className="file-name">{@props.upload.filename}</div>
|
2015-06-20 02:31:27 +08:00
|
|
|
</div>
|
2015-07-16 04:15:05 +08:00
|
|
|
|
2016-01-27 07:36:13 +08:00
|
|
|
<img src={@props.upload.targetPath} onDragStart={@_onDragStart}/>
|
2015-07-16 04:15:05 +08:00
|
|
|
</div>
|
2015-06-12 02:52:49 +08:00
|
|
|
</div>
|
|
|
|
|
2015-12-30 06:04:46 +08:00
|
|
|
_onDragStart: (event) ->
|
|
|
|
event.preventDefault()
|
|
|
|
|
2015-06-12 02:52:49 +08:00
|
|
|
module.exports = ImageFileUpload
|