You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
901 B
49 lines
901 B
3 years ago
|
import { system, get } from '@styled-system/core';
|
||
|
|
||
|
var isNumber = function isNumber(n) {
|
||
|
return typeof n === 'number' && !isNaN(n);
|
||
|
};
|
||
|
|
||
|
var getWidth = function getWidth(n, scale) {
|
||
|
return get(scale, n, !isNumber(n) || n > 1 ? n : n * 100 + '%');
|
||
|
};
|
||
|
|
||
|
var config = {
|
||
|
width: {
|
||
|
property: 'width',
|
||
|
scale: 'sizes',
|
||
|
transform: getWidth
|
||
|
},
|
||
|
height: {
|
||
|
property: 'height',
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
minWidth: {
|
||
|
property: 'minWidth',
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
minHeight: {
|
||
|
property: 'minHeight',
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
maxWidth: {
|
||
|
property: 'maxWidth',
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
maxHeight: {
|
||
|
property: 'maxHeight',
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
size: {
|
||
|
properties: ['width', 'height'],
|
||
|
scale: 'sizes'
|
||
|
},
|
||
|
overflow: true,
|
||
|
overflowX: true,
|
||
|
overflowY: true,
|
||
|
display: true,
|
||
|
verticalAlign: true
|
||
|
};
|
||
|
export var layout = system(config);
|
||
|
export default layout;
|