hideText.js 719 B

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = hideText;
  4. /**
  5. * CSS to hide text to show a background image in a SEO-friendly way.
  6. *
  7. * @example
  8. * // Styles as object usage
  9. * const styles = {
  10. * 'backgroundImage': 'url(logo.png)',
  11. * ...hideText(),
  12. * }
  13. *
  14. * // styled-components usage
  15. * const div = styled.div`
  16. * backgroundImage: url(logo.png);
  17. * ${hideText()};
  18. * `
  19. *
  20. * // CSS as JS Output
  21. *
  22. * 'div': {
  23. * 'backgroundImage': 'url(logo.png)',
  24. * 'textIndent': '101%',
  25. * 'overflow': 'hidden',
  26. * 'whiteSpace': 'nowrap',
  27. * }
  28. */
  29. function hideText() {
  30. return {
  31. textIndent: '101%',
  32. overflow: 'hidden',
  33. whiteSpace: 'nowrap'
  34. };
  35. }
  36. module.exports = exports.default;