@@ -4,16 +4,35 @@ typeof window !== "undefined" && (window.React = React); // for devtools
44typeof window !== "undefined" && ( window . Perf = React . addons . Perf ) ; // for devtools
55var _ = require ( 'lodash' ) ;
66var ResizableBox = require ( '../lib/ResizableBox.jsx' ) ;
7+ var Resizable = require ( '../lib/Resizable.jsx' ) ;
78require ( 'style!css!../css/styles.css' ) ;
89
910var TestLayout = module . exports = React . createClass ( {
1011 displayName : 'TestLayout' ,
1112
13+ getInitialState ( ) {
14+ return { width : 200 , height : 200 } ;
15+ } ,
16+
17+ onClick ( ) {
18+ this . setState ( { width : 200 , height : 200 } )
19+ } ,
20+
21+ onResize ( event , { element, size} ) {
22+ this . setState ( { width : size . width , height : size . height } ) ;
23+ } ,
24+
1225 render ( ) {
1326 return (
1427 < div >
28+ < button onClick = { this . onClick } style = { { 'marginBottom' : '10px' } } > Reset first element's width/height</ button >
29+ < Resizable className = "box" height = { this . state . height } width = { this . state . width } onResize = { this . onResize } >
30+ < div className = "box" style = { { width : this . state . width + 'px' , height : this . state . height + 'px' } } >
31+ < span className = "text" > { "Raw use of <Resizable> element. 200x200, no constraints." } </ span >
32+ </ div >
33+ </ Resizable >
1534 < ResizableBox className = "box" width = { 200 } height = { 200 } >
16- < span className = "text" > Resizable box, starting at 200x200, no constraints </ span >
35+ < span className = "text" > { "<ResizableBox>, same as above." } </ span >
1736 </ ResizableBox >
1837 < ResizableBox className = "box" width = { 200 } height = { 200 } draggableOpts = { { grid : [ 25 , 25 ] } } >
1938 < span className = "text" > Resizable box that snaps to even intervals of 25px.</ span >
@@ -30,6 +49,7 @@ var TestLayout = module.exports = React.createClass({
3049 < ResizableBox className = "box" width = { 200 } height = { 120 } lockAspectRatio = { true } >
3150 < span className = "text" > Resizable rectangle with a locked aspect ratio.</ span >
3251 </ ResizableBox >
52+
3353 </ div >
3454 ) ;
3555 }
0 commit comments