wix-style-react
Version:
wix-style-react
124 lines (106 loc) • 5.21 kB
JavaScript
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; }; }();
var _class, _temp;
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 { storiesOf } from '@storybook/react';
import { bool, number } from 'prop-types';
import Page from 'wix-style-react/Page';
import Button from 'wix-style-react/Button';
import Breadcrumbs from './Breadcrumbs';
import SomeContentComponent from './SomeContentComponent';
import SomeTailComponent from './SomeTailComponent';
var header = function header(breadcrumbs) {
return React.createElement(Page.Header, {
breadcrumbs: breadcrumbs,
title: 'Page Title',
subtitle: 'Page subtitle',
showBackButton: true,
onBackClicked: function onBackClicked() {},
actionsBar: React.createElement(
Button,
null,
'Action'
)
});
};
var content = function content(showScss) {
var shortContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return React.createElement(
Page.Content,
null,
React.createElement(SomeContentComponent, { showScss: showScss, shortContent: shortContent })
);
};
var tail = React.createElement(
Page.Tail,
null,
React.createElement(SomeTailComponent, null)
);
var FullPageExample = (_temp = _class = function (_React$Component) {
_inherits(FullPageExample, _React$Component);
function FullPageExample() {
_classCallCheck(this, FullPageExample);
return _possibleConstructorReturn(this, (FullPageExample.__proto__ || Object.getPrototypeOf(FullPageExample)).apply(this, arguments));
}
_createClass(FullPageExample, [{
key: 'render',
value: function render() {
return React.createElement(
'div',
{ 'data-hook': 'story-page-example' },
React.createElement(
'div',
{ 'data-hook': 'side-bar' },
'Sidebar'
),
React.createElement(
'div',
{ 'data-hook': 'body-content' },
React.createElement(
'div',
{ 'data-hook': 'top-bar' },
'TopBar'
),
React.createElement(
Page,
{
maxWidth: this.props.maxWidth,
sidePadding: this.props.sidePadding
},
header(Breadcrumbs),
tail,
content(true, this.props.shortContent)
)
)
);
}
}]);
return FullPageExample;
}(React.Component), _class.propTypes = {
shortContent: bool,
maxWidth: number,
sidePadding: number
}, _temp);
var displayAdditionalStories = false;
var story = storiesOf('2. Layout', module).add('2.6 + Page Example', function () {
return React.createElement(FullPageExample, null);
});
if (displayAdditionalStories) {
story.add('2.7 + Page Example with short content', function () {
return React.createElement(FullPageExample, { shortContent: true });
}).add('2.8 + Page Example with maxWidth', function () {
return React.createElement(FullPageExample, { maxWidth: 800 });
}).add('2.9 + Page Example with short content and maxWidth', function () {
return React.createElement(FullPageExample, { maxWidth: 800, shortContent: true });
}).add('2.10 + Page Example with sidePadding', function () {
return React.createElement(FullPageExample, { sidePadding: 0 });
}).add('2.11 + Page Example with short content and sidePadding', function () {
return React.createElement(FullPageExample, { sidePadding: 0, shortContent: true });
}).add('2.12 + Page Example with sidePadding and maxWidth', function () {
return React.createElement(FullPageExample, { sidePadding: 0, maxWidth: 800 });
}).add('2.13 + Page Example with short content sidePadding and maxWidth', function () {
return React.createElement(FullPageExample, { sidePadding: 0, maxWidth: 800, shortContent: true });
});
}