54
54
</ style >
55
55
</ head >
56
56
< body >
57
- < script src ="https://fb.me/react-with-addons-0.12.2.js "> </ script >
58
- < script src ="https://fb.me/JSXTransformer-0.12.2.js "> </ script >
57
+ < div id ="root "> </ div >
58
+ < script src ="../node_modules/react/dist/react-with-addons.js "> </ script >
59
+ < script src ="../node_modules/react/dist/react-dom.js "> </ script >
59
60
< script src ="../dist/react-draggable.js "> </ script >
60
- < script type ="text/jsx ">
61
- /** @jsx React.DOM */
61
+ < script >
62
62
var Draggable = ReactDraggable ;
63
63
var App = React . createClass ( {
64
64
getInitialState : function ( ) {
77
77
78
78
render : function ( ) {
79
79
return (
80
- < div className = "bounding-box" >
81
- < h1 > React Draggable</ h1 >
82
- < p >
83
- < a href = "https://github.com/mzabriskie/react-draggable/blob/master/example/index.html" > Demo Source</ a >
84
- </ p >
85
- < Draggable zIndex = { 100 } >
86
- < div className = "box" > I can be dragged anywhere</ div >
87
- </ Draggable >
88
- < Draggable axis = "x" zIndex = { 100 } >
89
- < div className = "box cursor-x" > I can only be dragged horizonally</ div >
90
- </ Draggable >
91
- < Draggable axis = "y" zIndex = { 100 } >
92
- < div className = "box cursor-y" > I can only be dragged vertically</ div >
93
- </ Draggable >
94
- < Draggable onDrag = { this . handleDrag } zIndex = { 100 } >
95
- < div className = "box" >
96
- < div > I track my position</ div >
97
- < div > top: { this . state . position . top } , left: { this . state . position . left } </ div >
98
- </ div >
99
- </ Draggable >
100
- < Draggable handle = "strong" zIndex = { 100 } >
101
- < div className = "box no-cursor" >
102
- < strong className = "cursor" > Drag here</ strong >
103
- < div > You must click my handle to drag me</ div >
104
- </ div >
105
- </ Draggable >
106
- < Draggable cancel = "strong" zIndex = { 100 } >
107
- < div className = "box" >
108
- < strong className = "no-cursor" > Can't drag here</ strong >
109
- < div > Dragging here works</ div >
110
- </ div >
111
- </ Draggable >
112
- < Draggable constrain = { constrain ( 25 ) } >
113
- < div className = "box" > I snap to a 25 x 25 grid</ div >
114
- </ Draggable >
115
- < Draggable constrain = { constrain ( 50 ) } >
116
- < div className = "box" > I snap to a 50 x 50 grid</ div >
117
- </ Draggable >
118
- < Draggable grid = { [ 25 , 25 ] } >
119
- < div className = "box" > I snap to a 25 x 25 grid (using deprecated grid API)</ div >
120
- </ Draggable >
121
- < Draggable grid = { [ 50 , 50 ] } >
122
- < div className = "box" > I snap to a 50 x 50 grid (using deprecated grid API)</ div >
123
- </ Draggable >
124
- < Draggable bound = "true" >
125
- < div className = "box" > I am bound to this box</ div >
126
- </ Draggable >
127
- < Draggable bound = "all point" >
128
- < div className = "box" > I am bound to this box by my top left corner</ div >
129
- </ Draggable >
130
- </ div >
80
+ React . DOM . div ( { className : "bounding-box" } ,
81
+ React . DOM . h1 ( { } , "React Draggable" ) ,
82
+ React . DOM . p ( { } ,
83
+ React . DOM . a (
84
+ { href : "https://github.com/mikepb/react-draggable/blob/master/example/index.html" } ,
85
+ "Demo Source" )
86
+ ) ,
87
+ React . createElement ( Draggable , { zIndex : 100 } ,
88
+ React . DOM . div ( { className : "box" } , "I can be dragged anywhere" )
89
+ ) ,
90
+ React . createElement ( Draggable , { axis : "x" , zIndex : 100 } ,
91
+ React . DOM . div ( { className : "box cursor-x" } , "I can only be dragged horizonally" )
92
+ ) ,
93
+ React . createElement ( Draggable , { axis : "y" , zIndex : 100 } ,
94
+ React . DOM . div ( { className : "box cursor-y" } , "I can only be dragged vertically" )
95
+ ) ,
96
+ React . createElement ( Draggable , { onDrag : this . handleDrag , zIndex : 100 } ,
97
+ React . DOM . div ( { className : "box" } ,
98
+ React . DOM . div ( { } , "I track my position" ) ,
99
+ React . DOM . div ( { } , "top: {this.state.position.top}, left: {this.state.position.left}" )
100
+ )
101
+ ) ,
102
+ React . createElement ( Draggable , { handle : "strong" , zIndex : 100 } ,
103
+ React . DOM . div ( { className : "box no-cursor" } ,
104
+ React . DOM . strong ( { className : "cursor" } , "Drag here" ) ,
105
+ React . DOM . div ( { } , "You must click my handle to drag me" )
106
+ )
107
+ ) ,
108
+ React . createElement ( Draggable , { cancel : "strong" , zIndex : 100 } ,
109
+ React . DOM . div ( { className : "box" } ,
110
+ React . DOM . strong ( { className : "no-cursor" } , "Can't drag here" ) ,
111
+ React . DOM . div ( { } , "Dragging here works" )
112
+ )
113
+ ) ,
114
+ React . createElement ( Draggable , { constrain : constrain ( 25 ) } ,
115
+ React . DOM . div ( { className : "box" } , "I snap to a 25 x 25 grid" )
116
+ ) ,
117
+ React . createElement ( Draggable , { constrain : constrain ( 50 ) } ,
118
+ React . DOM . div ( { className : "box" } , "I snap to a 50 x 50 grid" )
119
+ ) ,
120
+ React . createElement ( Draggable , { grid : [ 25 , 25 ] } ,
121
+ React . DOM . div ( { className : "box" } , "I snap to a 25 x 25 grid (using deprecated grid API)" )
122
+ ) ,
123
+ React . createElement ( Draggable , { grid : [ 50 , 50 ] } ,
124
+ React . DOM . div ( { className : "box" } , "I snap to a 50 x 50 grid (using deprecated grid API)" )
125
+ ) ,
126
+ React . createElement ( Draggable , { bound : "true" } ,
127
+ React . DOM . div ( { className : "box" } , "I am bound to this box" )
128
+ ) ,
129
+ React . createElement ( Draggable , { bound : "all point" } ,
130
+ React . DOM . div ( { className : "box" } , "I am bound to this box by my top left corner" )
131
+ )
132
+ )
131
133
) ;
132
134
}
133
135
} ) ;
@@ -148,7 +150,7 @@ <h1>React Draggable</h1>
148
150
} ;
149
151
}
150
152
151
- React . renderComponent ( < App /> , document . body ) ;
153
+ ReactDOM . render ( React . createElement ( App ) , document . getElementById ( "root" ) ) ;
152
154
</ script >
153
155
</ body >
154
156
</ html >
0 commit comments