Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 38 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,54 @@

## Usage

React = require 'react'
{div} = React.DOM
Dragarea = React.createFactory(require '../index')
```coffee
React = require 'react'
{div} = React.DOM
Dragarea = React.createFactory(require '../index')

App = React.createClass
App = React.createClass

_onDrop: (file) ->
console.log file
_onDrop: (file) ->
console.log file

_onRootDrop: ->
console.log 'root'
_onRootDrop: ->
console.log 'root'

render: ->
div null,
Dragarea
onDrop: @_onRootDrop,

for item in [1..10]
Dragarea
className: 'droparea-item'
key: item
onDrop: @_onDrop,
div 'Totally placeholder 1'
div 'Totally placeholder 2'
div 'Totally placeholder 3'

React.render(React.createElement(App), document.getElementById('app'))
render: ->
div null,
Dragarea
onDrop: @_onRootDrop,

for item in [1..10]
Dragarea
className: 'droparea-item'
key: item
onDrop: @_onDrop,
div 'Totally placeholder 1'
div 'Totally placeholder 2'
div 'Totally placeholder 3'

React.render(React.createElement(App), document.getElementById('app'))
```
You can fiddle with prepared demo. Clone the repo, `npm install` and `npm start`.
Then visit `localhost:3000`.

## Options - React props

disableClick: React.PropTypes.bool
onDragEnter: React.PropTypes.func
onDragEnterStopPropagation: React.PropTypes.bool
onDragLeave: React.PropTypes.func
onDragLeaveStopPropagation: React.PropTypes.bool
onDrop: React.PropTypes.func
onDropStopPropagation: React.PropTypes.bool
dropEffect: React.PropTypes.string
className: React.PropTypes.string
activeClassName: React.PropTypes.string
multiple: React.PropTypes.bool
supportedFormats: React.PropTypes.arrayOf(React.PropTypes.string)

```coffee
disableClick: React.PropTypes.bool
onDragEnter: React.PropTypes.func
onDragEnterStopPropagation: React.PropTypes.bool
onDragLeave: React.PropTypes.func
onDragLeaveStopPropagation: React.PropTypes.bool
onDrop: React.PropTypes.func
onDropStopPropagation: React.PropTypes.bool
dropEffect: React.PropTypes.string
className: React.PropTypes.string
activeClassName: React.PropTypes.string
multiple: React.PropTypes.bool
supportedFormats: React.PropTypes.arrayOf(React.PropTypes.string)
```
## Credits

This library is inspired by [react-dropzone](https://github.com/paramaggarwal/react-dropzone) by Param Aggarwal.