rem.js 836 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = void 0;
  4. var _pxto = _interopRequireDefault(require("../internalHelpers/_pxto"));
  5. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6. /**
  7. * Convert pixel value to rems. The default base value is 16px, but can be changed by passing a
  8. * second argument to the function.
  9. * @function
  10. * @param {string|number} pxval
  11. * @param {string|number} [base='16px']
  12. * @example
  13. * // Styles as object usage
  14. * const styles = {
  15. * 'height': rem('16px')
  16. * }
  17. *
  18. * // styled-components usage
  19. * const div = styled.div`
  20. * height: ${rem('16px')}
  21. * `
  22. *
  23. * // CSS in JS Output
  24. *
  25. * element {
  26. * 'height': '1rem'
  27. * }
  28. */
  29. var rem = (0, _pxto["default"])('rem');
  30. var _default = exports["default"] = rem;
  31. module.exports = exports.default;