UNPKG

@guardian/threads

Version:
23 lines 973 B
import { __extends } from "tslib"; import React, { Component } from 'react'; import styles from './Switch.module.css'; var Switch = /** @class */ (function (_super) { __extends(Switch, _super); function Switch() { return _super !== null && _super.apply(this, arguments) || this; } Switch.prototype.onChange = function (ev) { this.props.onChange(ev.target.checked); }; Switch.prototype.render = function () { var _this = this; return (React.createElement("label", { htmlFor: this.props.id, className: styles.switch }, React.createElement("input", { id: this.props.id, type: "checkbox", className: styles.checkbox, checked: this.props.checked || false, onChange: function (ev) { _this.onChange(ev); } }), React.createElement("div", { className: styles.target }))); }; return Switch; }(Component)); export { Switch }; //# sourceMappingURL=Switch.js.map