Skip to content

Commit

Permalink
Merge pull request #1 from appirio-tech/disable-option
Browse files Browse the repository at this point in the history
Disable option for uploader
  • Loading branch information
samsep committed Feb 4, 2016
2 parents 8eb225f + 362211f commit 24ff016
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
15 changes: 10 additions & 5 deletions components/FileUploader/FileUploader.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Dropzone = require 'react-dropzone'
Loader = require '../Loader/Loader.cjsx'
classNames = require 'classnames'

FileUploader = ({ multiple, onChange, loading, dragAndDrop }) ->
FileUploader = ({ multiple, onChange, loading, dragAndDrop, disableClick }) ->
dzContainerClassNames = classNames
'dropzone-container': true
'drag-and-drop': dragAndDrop
Expand All @@ -21,12 +21,17 @@ FileUploader = ({ multiple, onChange, loading, dragAndDrop }) ->
<UploadedFilesContainer/>

<div className={ dzContainerClassNames }>
<Dropzone multiple={multiple} onDrop={onChange} className="Dropzone">
<Dropzone multiple={multiple} onDrop={onChange} className="Dropzone" disableClick={disableClick}>
{
if dragAndDrop
if dragAndDrop && !disableClick
<p>click or drag files here to upload</p>
else
<button>choose files to upload</button>
else if dragAndDrop && disableClick
<p>file upload disabled</p>
else if !dragAndDrop
if disableClick
<button disabled>choose files to upload</button>
else
<button>choose files to upload</button>
}
</Dropzone>
</div>
Expand Down
8 changes: 8 additions & 0 deletions components/FileUploader/FileUploaderExamples.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ FileUploaderExamples = ->
<h1>dragNdrop is true</h1>

<FileUploader id={'123'} assetType={'work'} category={'development'} dragAndDrop={true}/>

<h1>disabled is true with drag</h1>

<FileUploader id={'123'} assetType={'work'} category={'development'} disableClick={true} dragAndDrop={true}/>

<h1>disabled is true with button</h1>

<FileUploader id={'123'} assetType={'work'} category={'development'} disableClick={true}/>
</div>

module.exports = FileUploaderExamples
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
"build": "webpack --config webpack.config.js; cp example/index.html dist/"
},
"dependencies": {
"appirio-styles": "0.0.23",
"appirio-styles": "0.0.25",
"appirio-tech-api-schemas": "^5.0.69",
"appirio-tech-client-app-layer": "^0.1.3",
"classnames": "^2.2.3",
"lodash": "^4.0.0",
"moment": "^2.11.2",
"react": "^0.14.7",
"react-datetime": "^2.0.2",
"react-dom": "^0.14.7",
"react-dropzone": "^3.3.2",
"react-redux": "^4.2.1",
"react-select": "^0.9.1"
Expand Down

0 comments on commit 24ff016

Please sign in to comment.