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 21:29:14 +02:00
|
|
|
className={classNames("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 ?
|
2022-10-08 23:26:48 +02:00
|
|
|
<>
|
2022-10-08 03:32:59 +02:00
|
|
|
<span className="ball on"></span>
|
|
|
|
<span className="label on">{this.props.on}</span>
|
2022-10-08 23:26:48 +02:00
|
|
|
</> :
|
|
|
|
<>
|
2022-10-08 03:32:59 +02:00
|
|
|
<span className="label off">{this.props.off}</span>
|
|
|
|
<span className="ball off"></span>
|
2022-10-08 23:26:48 +02:00
|
|
|
</>
|
2022-10-08 03:32:59 +02:00
|
|
|
}</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|