2022-10-08 03:32:59 +02:00
|
|
|
/** @jsx React.DOM */
|
|
|
|
|
2022-10-08 20:37:38 +02:00
|
|
|
var Slider = createReactClass({
|
2022-10-08 03:32:59 +02:00
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<div
|
2022-10-08 05:42:02 +02:00
|
|
|
className={"slider " + (this.props.value ? "on " : "off ") + this.props.className}
|
2022-10-08 03:32:59 +02:00
|
|
|
onClick={function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
if (this.props.onChange) {
|
|
|
|
this.props.onChange(!this.props.value);
|
|
|
|
}
|
|
|
|
}.bind(this)}
|
|
|
|
>{ this.props.value ?
|
|
|
|
<span>
|
|
|
|
<span className="ball on"></span>
|
|
|
|
<span className="label on">{this.props.on}</span>
|
|
|
|
</span> :
|
|
|
|
<span>
|
|
|
|
<span className="label off">{this.props.off}</span>
|
|
|
|
<span className="ball off"></span>
|
|
|
|
</span>
|
|
|
|
}</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|