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.
44 lines
702 B
44 lines
702 B
3 years ago
|
"use strict";
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
exports["default"] = cover;
|
||
|
|
||
|
/**
|
||
|
* CSS to fully cover an area. Can optionally be passed an offset to act as a "padding".
|
||
|
*
|
||
|
* @example
|
||
|
* // Styles as object usage
|
||
|
* const styles = {
|
||
|
* ...cover()
|
||
|
* }
|
||
|
*
|
||
|
* // styled-components usage
|
||
|
* const div = styled.div`
|
||
|
* ${cover()}
|
||
|
* `
|
||
|
*
|
||
|
* // CSS as JS Output
|
||
|
*
|
||
|
* div: {
|
||
|
* 'position': 'absolute',
|
||
|
* 'top': '0',
|
||
|
* 'right: '0',
|
||
|
* 'bottom': '0',
|
||
|
* 'left: '0'
|
||
|
* }
|
||
|
*/
|
||
|
function cover(offset) {
|
||
|
if (offset === void 0) {
|
||
|
offset = 0;
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
position: 'absolute',
|
||
|
top: offset,
|
||
|
right: offset,
|
||
|
bottom: offset,
|
||
|
left: offset
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.exports = exports.default;
|