UNPKG

wix-style-react

Version:
98 lines (85 loc) 3.79 kB
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import React from 'react'; import Button from 'wix-style-react/Button'; import GenericModalLayout from 'wix-style-react/GenericModalLayout'; import Modal from 'wix-style-react/Modal'; import styles from './ExampleStandard.scss'; var ExampleStandard = function (_React$Component) { _inherits(ExampleStandard, _React$Component); function ExampleStandard() { _classCallCheck(this, ExampleStandard); var _this = _possibleConstructorReturn(this, (ExampleStandard.__proto__ || Object.getPrototypeOf(ExampleStandard)).call(this)); _this.state = { isModalOpened: false }; return _this; } _createClass(ExampleStandard, [{ key: 'openModal', value: function openModal() { this.setState({ isModalOpened: true }); } }, { key: 'closeModal', value: function closeModal() { this.setState({ isModalOpened: false }); } }, { key: 'render', value: function render() { var _this2 = this; return React.createElement( 'div', null, React.createElement( Button, { dataHook: 'open-default-generic-modal-layout-in-modal-button', onClick: function onClick() { return _this2.openModal(); } }, 'Open Layout in Modal' ), React.createElement( Modal, { isOpen: this.state.isModalOpened, onRequestClose: function onRequestClose() { return _this2.closeModal(); }, contentLabel: 'Generic Modal Layout', shouldDisplayCloseButton: true }, React.createElement(GenericModalLayout, { header: React.createElement( 'div', { className: styles.header }, 'header' ), content: React.createElement( 'div', { className: styles.content }, 'content' ), footer: React.createElement( 'div', { className: styles.footer }, 'footer' ), dataHook: 'default-generic-modal-layout' }) ) ); } }]); return ExampleStandard; }(React.Component); export { ExampleStandard as default };