cover.js 699 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = cover;
  4. /**
  5. * CSS to fully cover an area. Can optionally be passed an offset to act as a "padding".
  6. *
  7. * @example
  8. * // Styles as object usage
  9. * const styles = {
  10. * ...cover()
  11. * }
  12. *
  13. * // styled-components usage
  14. * const div = styled.div`
  15. * ${cover()}
  16. * `
  17. *
  18. * // CSS as JS Output
  19. *
  20. * div: {
  21. * 'position': 'absolute',
  22. * 'top': '0',
  23. * 'right: '0',
  24. * 'bottom': '0',
  25. * 'left: '0'
  26. * }
  27. */
  28. function cover(offset) {
  29. if (offset === void 0) {
  30. offset = 0;
  31. }
  32. return {
  33. position: 'absolute',
  34. top: offset,
  35. right: offset,
  36. bottom: offset,
  37. left: offset
  38. };
  39. }
  40. module.exports = exports.default;