Skip to content

Commit 06d2d31

Browse files
committed
Merge pull request #29 from hustxiaoc/master
add dragging className
2 parents 6565fac + d2b44d4 commit 06d2d31

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/draggable.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/** @jsx React.DOM */
44
var React = require('react/addons');
55
var emptyFunction = require('react/lib/emptyFunction');
6+
var CX = React.addons.classSet;
67

78
function createUIEvent(draggable) {
89
return {
@@ -445,12 +446,16 @@ module.exports = React.createClass({
445446
if (this.state.dragging && !isNaN(this.props.zIndex)) {
446447
style.zIndex = this.props.zIndex;
447448
}
448-
449+
450+
var className = CX({
451+
'react-draggable': true,
452+
'react-draggable-dragging': this.state.dragging
453+
});
449454
// Reuse the child provided
450455
// This makes it flexible to use whatever element is wanted (div, ul, etc)
451456
return React.addons.cloneWithProps(React.Children.only(this.props.children), {
452457
style: style,
453-
className: 'react-draggable',
458+
className: className,
454459

455460
onMouseDown: this.handleDragStart,
456461
onTouchStart: function(ev){

0 commit comments

Comments
 (0)