UNPKG

3.35 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = void 0;
9
10var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
11
12var _react = _interopRequireDefault(require("react"));
13
14var _styles = require("@material-ui/core/styles");
15
16var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
17
18var _propTypes = _interopRequireDefault(require("prop-types"));
19
20/* eslint-disable import/no-extraneous-dependencies */
21// flow-disable-next-line
22// flow-disable-next-line
23var styles = function styles(_ref) {
24 var _container;
25
26 var breakpoints = _ref.breakpoints;
27 return {
28 // paddingLeft 39px and 31px are for alignment with the burger icon
29 container: (_container = {
30 display: 'flex',
31 alignItems: 'flex-start',
32 height: '100%',
33 padding: '30px 39px 0'
34 }, (0, _defineProperty2.default)(_container, breakpoints.up('xs'), {
35 padding: '30px 39px 0'
36 }), (0, _defineProperty2.default)(_container, breakpoints.down('xs'), {
37 padding: 0
38 }), _container),
39 containerMiddle: {
40 paddingTop: 0
41 },
42 paper: (0, _defineProperty2.default)({
43 width: '100%',
44 margin: '0 auto'
45 }, breakpoints.down('xs'), {
46 height: '100%',
47 boxShadow: 'none',
48 padding: '25px 31px 0' // Make 25 customizable when props are supported
49
50 }),
51 paperMiddle: (0, _defineProperty2.default)({
52 width: 'auto',
53 maxWidth: '100%',
54 margin: 'auto'
55 }, breakpoints.down('xs'), {
56 width: '100%'
57 }),
58 paperPadding: {
59 padding: 30
60 },
61 // Make it customizable when props are supported
62 noPaper: {
63 background: 'transparent',
64 boxShadow: 'none'
65 }
66 };
67};
68
69var PageJSX = function PageJSX(_ref2) {
70 var children = _ref2.children,
71 classes = _ref2.classes,
72 middle = _ref2.middle,
73 noPadding = _ref2.noPadding,
74 noPaper = _ref2.noPaper,
75 _ref2$containerClass = _ref2.containerClass,
76 containerClass = _ref2$containerClass === void 0 ? '' : _ref2$containerClass,
77 _ref2$paperClass = _ref2.paperClass,
78 paperClass = _ref2$paperClass === void 0 ? '' : _ref2$paperClass,
79 _ref2$maxWidth = _ref2.maxWidth,
80 maxWidth = _ref2$maxWidth === void 0 ? 1012 : _ref2$maxWidth;
81 return _react.default.createElement("div", {
82 className: "".concat(classes.container, " ").concat(containerClass, " ").concat(middle ? classes.containerMiddle : '')
83 }, _react.default.createElement(_Paper.default, {
84 className: "".concat(classes.paper, " ").concat(paperClass, " ").concat(noPaper ? classes.noPaper : '', " ").concat(noPadding ? '' : classes.paperPadding, " ").concat(middle ? classes.paperMiddle : ''),
85 style: {
86 maxWidth: maxWidth
87 }
88 }, children));
89};
90
91PageJSX.propTypes = {
92 children: _propTypes.default.any,
93 classes: _propTypes.default.object.isRequired,
94 noPaper: _propTypes.default.bool,
95 noPadding: _propTypes.default.bool,
96 containerClass: _propTypes.default.string,
97 paperClass: _propTypes.default.string,
98 maxWidth: _propTypes.default.any,
99 middle: _propTypes.default.bool
100};
101var Page = (0, _styles.withStyles)(styles)(PageJSX);
102var _default = Page;
103exports.default = _default;
\No newline at end of file