Last active
August 29, 2015 14:16
-
-
Save gabrielhpugliese/6c5b52fd658b991ae5a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function (require) { | |
'use strict'; | |
var React = require('react'); | |
var _ = require('underscore'); | |
var DragDropMixin = require('react-dnd').DragDropMixin; | |
var ItemTypes = require('components/ItemTypes'); | |
var dragSource = { | |
beginDrag: function (component) { | |
debugger; | |
return { | |
item: { | |
id: component.props.id | |
} | |
}; | |
} | |
}; | |
var dropTarget = { | |
over: function (component, id) { | |
debugger; | |
} | |
}; | |
var DraggableDiv = React.createClass({ | |
mixins: [DragDropMixin], | |
statics: { | |
configureDragDrop: function (register) { | |
register(ItemTypes.INPUT, { | |
dragSource: dragSource, | |
dropTarget: dropTarget | |
}); | |
} | |
}, | |
render: function () { | |
return <div | |
{...this.dragSourceFor(ItemTypes.INPUT)} | |
{...this.dropTargetFor(ItemTypes.INPUT)} | |
> | |
<h1>teste</h1> | |
</div>; | |
} | |
}); | |
var DraggableForm = React.createClass({ | |
render: function () { | |
return <div>{_.map([1,2,3,4,5], function (index) { | |
return <DraggableDiv id="div-{index}" />; | |
})}</div>; | |
} | |
}); | |
return DraggableForm; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment