@@ -10,7 +10,7 @@ var SwitchButton = React.createClass({
1010 displayName : 'Switch Button' ,
1111
1212 // Version
13- version : '2.1 .0' ,
13+ version : '2.2 .0' ,
1414
1515 /**
1616 * The props types.
@@ -25,6 +25,7 @@ var SwitchButton = React.createClass({
2525 disabled : React . PropTypes . bool ,
2626 theme : React . PropTypes . string ,
2727 checked : React . PropTypes . string ,
28+ mode : React . PropTypes . string ,
2829 onChange : React . PropTypes . func
2930 } ,
3031
@@ -44,6 +45,7 @@ var SwitchButton = React.createClass({
4445 defaultChecked : false ,
4546 theme : 'rsbc-switch-button-flat-round' ,
4647 checked : null ,
48+ mode : "switch" ,
4749 onChange : this . handleChange
4850 } ;
4951 } ,
@@ -61,7 +63,8 @@ var SwitchButton = React.createClass({
6163 render : function render ( ) {
6264 var id = undefined ,
6365 label = undefined ,
64- labelRight = undefined ;
66+ labelRight = undefined ,
67+ mode = this . props . mode || "switch" ;
6568
6669 if ( this . props . id === '' && this . props . name !== '' ) {
6770 id = this . props . name ;
@@ -75,7 +78,11 @@ var SwitchButton = React.createClass({
7578 labelRight = React . createElement ( 'label' , { htmlFor : id } , this . props . labelRight ) ;
7679 }
7780
78- return React . createElement ( 'div' , { className : 'rsbc-switch-button ' + this . props . theme + ( this . props . disabled ? " disabled" : "" ) } , label , React . createElement ( 'input' , { onChange : this . props . onChange ,
81+ if ( [ 'switch' , 'select' ] . indexOf ( mode ) < - 1 ) {
82+ mode = "switch" ;
83+ }
84+
85+ return React . createElement ( 'div' , { className : 'rsbc-switch-button rsbc-mode-' + mode + ' ' + this . props . theme + ( this . props . disabled ? " disabled" : "" ) } , label , React . createElement ( 'input' , { onChange : this . props . onChange ,
7986 defaultChecked : this . props . defaultChecked ,
8087 disabled : this . props . disabled ,
8188 id : id , name : this . props . name ,
0 commit comments