UNPKG

@gannochenko/ui.styled-components

Version:

<!-- PROJECT SHIELDS --> <!-- *** Reference links are enclosed in brackets [ ] instead of parentheses ( ). *** See the bottom of this document for the declaration of the reference variables *** for contributors-url, forks-url, etc. This is an optional, co

19 lines 811 B
import { css } from 'styled-components'; const getValue = (value, theme) => { if (typeof value === 'string') { return value; } if (theme && typeof theme.spacing === 'function') { return theme.spacing(value); } return value; }; const getStyleFor = (property, value, theme) => (value !== undefined ? `${property}: ${getValue(value, theme)};` : ''); export const marginProps = ({ margin: allMargin, marginTop, marginBottom, marginLeft, marginRight, theme, }) => css ` ${getStyleFor('margin', allMargin, theme)}; ${getStyleFor('margin-top', marginTop, theme)}; ${getStyleFor('margin-bottom', marginBottom, theme)}; ${getStyleFor('margin-left', marginLeft, theme)}; ${getStyleFor('margin-right', marginRight, theme)}; `; //# sourceMappingURL=marginProps.js.map