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.
46 lines
855 B
46 lines
855 B
import { system, get } from '@styled-system/core'
|
|
|
|
const isNumber = n => typeof n === 'number' && !isNaN(n)
|
|
const getWidth = (n, scale) =>
|
|
get(scale, n, !isNumber(n) || n > 1 ? n : n * 100 + '%')
|
|
|
|
const 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 const layout = system(config)
|
|
export default layout
|