Skip to content

Commit 4ea29e7

Browse files
committed
replace reactify with babelify
Refs: #21
1 parent 3e67379 commit 4ea29e7

7 files changed

Lines changed: 63841 additions & 16937 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ and then include the *css* in your HTML page.
3838

3939
Of course, you can also use the standalone build by including `react-switch-button.js` and `react-switch-button.css` in your page. (If you do this though you'll also need to include the dependencies.) For example:
4040
```html
41-
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
42-
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
41+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js"></script>
42+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js"></script>
4343
<script src="https://unpkg.com/classnames/index.js"></script>
4444
<script src="https://unpkg.com/react-switch-button/dist/react-switch-button.js"></script>
4545

dist/react-switch-button.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(function (global){
33
'use strict';
44

5-
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
5+
var React = typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null;
66

77
var SwitchButton = React.createClass({
88

@@ -68,34 +68,19 @@ var SwitchButton = React.createClass({
6868
}
6969

7070
if (this.props.label !== '') {
71-
label = React.createElement(
72-
'label',
73-
{ htmlFor: id },
74-
this.props.label
75-
);
71+
label = React.createElement('label', { htmlFor: id }, this.props.label);
7672
}
7773

7874
if (this.props.labelRight !== '') {
79-
labelRight = React.createElement(
80-
'label',
81-
{ htmlFor: id },
82-
this.props.labelRight
83-
);
75+
labelRight = React.createElement('label', { htmlFor: id }, this.props.labelRight);
8476
}
8577

86-
return React.createElement(
87-
'div',
88-
{ className: 'rsbc-switch-button ' + this.props.theme + (this.props.disabled ? " disabled" : "") },
89-
label,
90-
React.createElement('input', { onChange: this.props.onChange,
91-
defaultChecked: this.props.defaultChecked,
92-
disabled: this.props.disabled,
93-
id: id, name: this.props.name,
94-
type: 'checkbox',
95-
value: '1' }),
96-
React.createElement('label', { htmlFor: id }),
97-
labelRight
98-
);
78+
return React.createElement('div', { className: 'rsbc-switch-button ' + this.props.theme + (this.props.disabled ? " disabled" : "") }, label, React.createElement('input', { onChange: this.props.onChange,
79+
defaultChecked: this.props.defaultChecked,
80+
disabled: this.props.disabled,
81+
id: id, name: this.props.name,
82+
type: 'checkbox',
83+
value: '1' }), React.createElement('label', { htmlFor: id }), labelRight);
9984
}
10085

10186
});

example/dist/app.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -81,49 +81,11 @@ var App = React.createClass({
8181

8282
var rows = code.map(function (o, i) {
8383

84-
return React.createElement(
85-
'div',
86-
{ className: 'example',
87-
key: i },
88-
React.createElement(
89-
'h3',
90-
null,
91-
o.label
92-
),
93-
React.createElement(
94-
'pre',
95-
null,
96-
o.code
97-
),
98-
React.createElement(
99-
'div',
100-
{ className: 'result' },
101-
o.object
102-
)
103-
);
84+
return React.createElement('div', { className: 'example',
85+
key: i }, React.createElement('h3', null, o.label), React.createElement('pre', null, o.code), React.createElement('div', { className: 'result' }, o.object));
10486
});
10587

106-
return React.createElement(
107-
'div',
108-
{ className: 'examples' },
109-
React.createElement(
110-
'h1',
111-
null,
112-
'Say Hello, React Switch Button'
113-
),
114-
React.createElement(
115-
'div',
116-
{ className: 'example' },
117-
React.createElement(
118-
'h3',
119-
null,
120-
'New in v.2.1.0'
121-
)
122-
),
123-
React.createElement(SwitchButton, { name: 'switch-theme', label: 'Switch Theme', onChange: this.onChange }),
124-
React.createElement('hr', null),
125-
rows
126-
);
88+
return React.createElement('div', { className: 'examples' }, React.createElement('h1', null, 'Say Hello, React Switch Button'), React.createElement('div', { className: 'example' }, React.createElement('h3', null, 'New in v.2.1.0')), React.createElement(SwitchButton, { name: 'switch-theme', label: 'Switch Theme', onChange: this.onChange }), React.createElement('hr', null), rows);
12789
}
12890
});
12991

example/dist/bundle.js

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,34 +67,19 @@ var SwitchButton = React.createClass({
6767
}
6868

6969
if (this.props.label !== '') {
70-
label = React.createElement(
71-
'label',
72-
{ htmlFor: id },
73-
this.props.label
74-
);
70+
label = React.createElement('label', { htmlFor: id }, this.props.label);
7571
}
7672

7773
if (this.props.labelRight !== '') {
78-
labelRight = React.createElement(
79-
'label',
80-
{ htmlFor: id },
81-
this.props.labelRight
82-
);
74+
labelRight = React.createElement('label', { htmlFor: id }, this.props.labelRight);
8375
}
8476

85-
return React.createElement(
86-
'div',
87-
{ className: 'rsbc-switch-button ' + this.props.theme + (this.props.disabled ? " disabled" : "") },
88-
label,
89-
React.createElement('input', { onChange: this.props.onChange,
90-
defaultChecked: this.props.defaultChecked,
91-
disabled: this.props.disabled,
92-
id: id, name: this.props.name,
93-
type: 'checkbox',
94-
value: '1' }),
95-
React.createElement('label', { htmlFor: id }),
96-
labelRight
97-
);
77+
return React.createElement('div', { className: 'rsbc-switch-button ' + this.props.theme + (this.props.disabled ? " disabled" : "") }, label, React.createElement('input', { onChange: this.props.onChange,
78+
defaultChecked: this.props.defaultChecked,
79+
disabled: this.props.disabled,
80+
id: id, name: this.props.name,
81+
type: 'checkbox',
82+
value: '1' }), React.createElement('label', { htmlFor: id }), labelRight);
9883
}
9984

10085
});

0 commit comments

Comments
 (0)