clearFix.js 703 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = clearFix;
  4. /**
  5. * CSS to contain a float (credit to CSSMojo).
  6. *
  7. * @example
  8. * // Styles as object usage
  9. * const styles = {
  10. * ...clearFix(),
  11. * }
  12. *
  13. * // styled-components usage
  14. * const div = styled.div`
  15. * ${clearFix()}
  16. * `
  17. *
  18. * // CSS as JS Output
  19. *
  20. * '&::after': {
  21. * 'clear': 'both',
  22. * 'content': '""',
  23. * 'display': 'table'
  24. * }
  25. */
  26. function clearFix(parent) {
  27. var _ref;
  28. if (parent === void 0) {
  29. parent = '&';
  30. }
  31. var pseudoSelector = parent + "::after";
  32. return _ref = {}, _ref[pseudoSelector] = {
  33. clear: 'both',
  34. content: '""',
  35. display: 'table'
  36. }, _ref;
  37. }
  38. module.exports = exports.default;