size.js 604 B

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = size;
  4. /**
  5. * Shorthand to set the height and width properties in a single statement.
  6. * @example
  7. * // Styles as object usage
  8. * const styles = {
  9. * ...size('300px', '250px')
  10. * }
  11. *
  12. * // styled-components usage
  13. * const div = styled.div`
  14. * ${size('300px', '250px')}
  15. * `
  16. *
  17. * // CSS as JS Output
  18. *
  19. * div {
  20. * 'height': '300px',
  21. * 'width': '250px',
  22. * }
  23. */
  24. function size(height, width) {
  25. if (width === void 0) {
  26. width = height;
  27. }
  28. return {
  29. height: height,
  30. width: width
  31. };
  32. }
  33. module.exports = exports.default;