joyent-portal/ui/src/shared/composers.js

63 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-12-09 16:57:23 +02:00
const constants = require('./constants');
2016-12-06 13:50:24 +02:00
const Styled = require('styled-components');
2016-12-09 16:57:23 +02:00
const {
boxes
} = constants;
2016-12-06 13:50:24 +02:00
const {
css
} = Styled;
module.exports = {
verticallyAlignCenter: css`
2016-12-09 16:57:23 +02:00
/* Need to place position:relative on parent */
2016-12-06 13:50:24 +02:00
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
`,
clear: css`
display: block;
content: "";
clear: both;
2016-12-09 16:57:23 +02:00
`,
moveZ: ({
amount = 0,
position = 'relative'
}) => css`
position: ${position};
z-index: ${amount};
`,
baseBox: ({
radius = boxes.borderRadius,
border = boxes.border.unchecked,
shadow = boxes.bottomShaddow
2016-12-09 19:15:08 +02:00
} = {}) => css`
2016-12-09 16:57:23 +02:00
border: ${border};
border-radius: ${radius};
box-shadow: ${shadow};
`,
pseudoEl: (
positions = {}
) => css`
content: "";
position: absolute;
top: ${positions.top || 'auto'};
right: ${positions.right || 'auto'};
bottom: ${positions.bottom || 'auto'};
left: ${positions.left || 'auto'};
2017-01-19 16:59:59 +02:00
`,
clearfix: css`
&:before,
&:after {
content:"";
display:table;
}
&:after {
clear:both;
}
`,
2016-12-06 13:50:24 +02:00
};