UNPKG

@up-group/react-controls

Version:

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get

63 lines 3.38 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var react_1 = require("@storybook/react"); var theming_1 = require("../../../Common/theming"); var themedComponents_1 = require("../../../Common/theming/themedComponents"); var _1 = require("./"); var Label_1 = require("../../Display/Label"); var Notification_1 = require("../../Display/Notification"); var Box_1 = require("../../Containers/Box"); var ToggleWrapper = (function (_super) { __extends(ToggleWrapper, _super); function ToggleWrapper(props, context) { var _this = _super.call(this, props, context) || this; _this.onChange = function (value) { _this.setState({ checked: value }); }; _this.state = { checked: false }; return _this; } ToggleWrapper.prototype.render = function () { return (React.createElement(_1.default, { size: this.props.size, value: true, checked: this.state.checked === true, onChange: this.onChange })); }; ToggleWrapper.defaultProps = { size: 'normal' }; return ToggleWrapper; }(React.Component)); react_1.storiesOf('UpToggle', module) .addWithInfo('Simple usage', 'Utilisation avec plusieurs options', function () { return (React.createElement(themedComponents_1.ThemeProvider, { theme: theming_1.default }, React.createElement(Box_1.default, { style: { margin: "40px 30px" } }, React.createElement(Notification_1.default, { status: "info" }, "Le composant ", React.createElement("code", null, "UpToggle"), " a un comportement similaire \u00E0 ", React.createElement("code", null, "UpCheckBox"), " mais avec une UX centr\u00E9e sur l'id\u00E9e d'activation/d\u00E9sactivation. Il existe 3 tailles selon le cas d'utilisation : ", React.createElement("code", null, "small"), ", ", React.createElement("code", null, "normal"), " et ", React.createElement("code", null, "large"), "."), React.createElement(Box_1.default, { style: { margin: "30px" } }, React.createElement(Label_1.default, { textAlign: "left", inline: true, width: "medium", text: "Activation de ... :" }, React.createElement(ToggleWrapper, { size: 'small' })), React.createElement(Label_1.default, { textAlign: "left", inline: true, width: "medium", text: "Activation de ... :" }, React.createElement(ToggleWrapper, { size: 'normal' })), React.createElement(Label_1.default, { textAlign: "left", inline: true, width: "medium", text: "Activation de ... :" }, React.createElement(ToggleWrapper, { size: 'large' })))))); }); //# sourceMappingURL=index.stories.js.map