_icons.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. @use 'sass:string';
  2. // Set SVG icons to use the current text color in the location they appear as
  3. // their default fill color. Can be overridden for a specific icon by either
  4. // the color or fill properties.
  5. .icon {
  6. fill: currentColor;
  7. }
  8. .icon.teal {
  9. color: theme('colors.text-button-outline-default');
  10. }
  11. .icon.white {
  12. color: theme('colors.surface-page');
  13. }
  14. .icon:after {
  15. text-align: end;
  16. }
  17. // =============================================================================
  18. // Icon factory methods
  19. // =============================================================================
  20. // RemovedInWagtail60Warning
  21. // Font icons unused in Wagtail core, kept for backwards compatibility with third-party customisations.
  22. @each $icon, $content in $icons {
  23. .icon-#{$icon}:before {
  24. content: string.quote(#{$content});
  25. }
  26. }
  27. @each $icon in $icons-after {
  28. .icon-#{$icon}-after::after {
  29. content: '';
  30. mask-image: url('#{$images-root}icons/#{$icon}.svg');
  31. width: 1em;
  32. height: 1em;
  33. display: inline-block;
  34. background-color: currentColor;
  35. }
  36. }
  37. // =============================================================================
  38. // Custom config for various icons
  39. // =============================================================================
  40. .icon-download {
  41. // Credit: Icon made by Freepik from Flaticon.com
  42. }
  43. .icon-view:before,
  44. .icon-no-view:before {
  45. // icon-font
  46. vertical-align: -3.5px;
  47. font-size: 1.1rem;
  48. }
  49. .icon-spinner:after,
  50. .icon-spinner:before {
  51. // iconfont
  52. width: 1em;
  53. animation: spin-wag 0.5s infinite linear;
  54. display: inline-block;
  55. }
  56. // For SVG icons, add spinner styles onto the use element,
  57. // so an icon can be turned into a spinner by changing the href only.
  58. // This allows us to switch any icon to a spinner with much less boilerplate.
  59. use[href='#icon-spinner'] {
  60. animation: spin-wag 0.5s infinite linear;
  61. transform-origin: center;
  62. }
  63. .icon-horizontalrule:before {
  64. font-family: $font-sans;
  65. }
  66. .icon-larger:before {
  67. font-size: 1.5em;
  68. }
  69. .icon.text-replace {
  70. // iconfont
  71. font-size: 0;
  72. line-height: 0;
  73. overflow: hidden;
  74. &:before {
  75. margin-inline-end: 0;
  76. font-size: 1rem;
  77. display: inline-block;
  78. width: 100%;
  79. line-height: 1.2em;
  80. text-align: center;
  81. vertical-align: middle;
  82. }
  83. }
  84. .text-replace {
  85. font-size: 0;
  86. line-height: 0;
  87. overflow: hidden;
  88. .icon {
  89. @include svg-icon(1rem, middle);
  90. }
  91. }
  92. @keyframes spin-wag {
  93. 0% {
  94. transform: rotate(0deg);
  95. }
  96. 100% {
  97. transform: rotate(360deg);
  98. }
  99. }
  100. .icon-spinner:after {
  101. display: inline-block;
  102. line-height: 1;
  103. }
  104. // stylelint-disable-next-line no-duplicate-selectors
  105. .icon {
  106. &.initial {
  107. @include svg-icon(1em, $position: initial);
  108. }
  109. &.default {
  110. @include svg-icon(1.5em);
  111. }
  112. &.middle {
  113. @include svg-icon(1.5em, $position: middle);
  114. }
  115. &--flipped {
  116. transform: scaleX(-1);
  117. }
  118. }
  119. .icon.locale-error {
  120. vertical-align: text-top;
  121. margin-inline-end: 0.5em;
  122. width: 1.5em;
  123. height: 1.5em;
  124. color: theme('colors.critical.200');
  125. }
  126. .icon-wagtail {
  127. width: 100%;
  128. height: auto;
  129. }
  130. .icon-wagtail__wordmark {
  131. fill: theme('colors.text-context');
  132. }