UNPKG

4.22 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.Column = exports.Row = exports.Grid = undefined;
7
8var _templateObject = _taggedTemplateLiteral(['\n margin-left: auto;\n margin-right: auto;\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n'], ['\n margin-left: auto;\n margin-right: auto;\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n']),
9 _templateObject2 = _taggedTemplateLiteral(['\n display: flex;\n flex-wrap: wrap;\n flex-direction: ', ';\n justify-content: ', ';\n ', ' { ', ' }\n ', ' { ', ' }\n ', ' { ', ' }\n ', ' { ', ' }\n'], ['\n display: flex;\n flex-wrap: wrap;\n flex-direction: ', ';\n justify-content: ', ';\n ', ' { ', ' }\n ', ' { ', ' }\n ', ' { ', ' }\n ', ' { ', ' }\n']),
10 _templateObject3 = _taggedTemplateLiteral(['\n display: ', ';\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: 100%;\n max-width: 100%;\n box-sizing: border-box;\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n'], ['\n display: ', ';\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: 100%;\n max-width: 100%;\n box-sizing: border-box;\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n\n ', ' {\n ', '\n ', '\n }\n']);
11
12var _styledComponents = require('styled-components');
13
14var _styledComponents2 = _interopRequireDefault(_styledComponents);
15
16function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
19
20var ms = function ms(size) {
21 return '@media screen and (min-width: ' + size + ')';
22};
23var mx = function mx(point) {
24 return function (props) {
25 return ms(props.theme.breakpoints[point]);
26 };
27};
28var p = function p(n) {
29 return typeof n !== 'undefined' ? n * 100 + '%' : null;
30};
31
32var width = function width(key) {
33 return function (props) {
34 return props[key] ? 'flex-basis: ' + p(props[key]) + '; max-width: ' + p(props[key]) + ';' : null;
35 };
36};
37
38var gutter = function gutter(size) {
39 return function (props) {
40 var gutterSize = props.theme.grid[size].gutter;
41 return '\n padding-left: calc(' + gutterSize + ' / 2);\n padding-right: calc(' + gutterSize + ' / 2);\n ';
42 };
43};
44
45var push = function push(size) {
46 return function (props) {
47 var gutterSize = props.theme.grid[size].gutter;
48 return '\n margin-left: calc(-' + gutterSize + ' / 2);\n margin-right: calc(-' + gutterSize + ' / 2);\n ';
49 };
50};
51
52var offset = function offset(size) {
53 return function (props) {
54 var offsetSize = props.theme.grid[size].offset;
55 return '\n padding-left: ' + offsetSize + '\n padding-right: ' + offsetSize + '\n ';
56 };
57};
58
59var maxWidth = function maxWidth(size) {
60 return function (props) {
61 var maxSize = props.theme.grid[size].maxWidth;
62 return props.fixed ? 'max-width: ' + maxSize : null;
63 };
64};
65
66var Grid = exports.Grid = _styledComponents2.default.div(_templateObject, mx('small'), offset('small'), maxWidth('small'), mx('medium'), offset('medium'), maxWidth('medium'), mx('wide'), offset('wide'), maxWidth('wide'), mx('extra-wide'), offset('extra-wide'), maxWidth('extra-wide'));
67
68var Row = exports.Row = _styledComponents2.default.div(_templateObject2, function (props) {
69 return props.column ? 'column' : 'row';
70}, function (props) {
71 return props.justify || 'space-between';
72}, mx('small'), push('small'), mx('medium'), push('medium'), mx('wide'), push('wide'), mx('extra-wide'), push('extra-wide'));
73
74var Column = exports.Column = _styledComponents2.default.div(_templateObject3, function (props) {
75 return props.flex ? 'flex' : 'block';
76}, mx('small'), width('sm'), gutter('small'), mx('medium'), width('md'), gutter('medium'), mx('wide'), width('wd'), gutter('wide'), mx('extra-wide'), width('xwd'), gutter('extra-wide'));
\No newline at end of file