_icons.scss 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. @use "sass:string";
  2. // The wagtail font isn't available in WOFF2, so a @font-face is set here without a mixin.
  3. @font-face {
  4. font-family: 'wagtail';
  5. src: url('#{$font-root}wagtail.woff') format('woff');
  6. font-weight: normal;
  7. font-style: normal;
  8. }
  9. // Set SVG icons to use the current text color in the location they appear as
  10. // their default fill color. Can be overridden for a specific icon by either
  11. // the color or fill properties.
  12. .icon {
  13. fill: currentColor;
  14. }
  15. .icon.teal {
  16. color: $color-teal;
  17. }
  18. .icon.white {
  19. color: #fff;
  20. }
  21. .icon:before,
  22. .icon:after,
  23. .hallotoolbar [class^='icon-'],
  24. .hallotoolbar [class*=' icon-']:before,
  25. .hallotoolbar [class^='icon-']:before {
  26. @include icon(); // from _mixins.scss
  27. }
  28. // stylelint-disable-next-line no-duplicate-selectors
  29. .icon:after,
  30. .hallotoolbar [class^='icon-']:after,
  31. .hallotoolbar [class^='icon-']:after {
  32. text-align: right;
  33. }
  34. // stylelint-disable-next-line no-duplicate-selectors
  35. .hallotoolbar [class^='icon-'],
  36. .hallotoolbar [class*=' icon-']:before,
  37. .hallotoolbar [class*=' icon-']:before,
  38. .hallotoolbar [class^='icon-']:before {
  39. vertical-align: -10%;
  40. margin-right: 0;
  41. }
  42. // =============================================================================
  43. // Icon factory methods
  44. // =============================================================================
  45. @each $icon, $content in $icons {
  46. .icon-#{$icon}:before {
  47. content: string.quote(#{$content});
  48. }
  49. }
  50. @each $icon, $content in $icons-after {
  51. .icon-#{$icon}:after {
  52. content: string.quote(#{$content});
  53. }
  54. }
  55. // =============================================================================
  56. // Custom config for various icons
  57. // =============================================================================
  58. .icon-download {
  59. // Credit: Icon made by Freepik from Flaticon.com
  60. }
  61. .icon-view:before,
  62. .icon-no-view:before { // icon-font
  63. vertical-align: -3.5px;
  64. font-size: 1.1rem;
  65. }
  66. .icon-spinner:after,
  67. .icon-spinner:before { // iconfont
  68. width: 1em;
  69. animation: spin-wag 0.5s infinite linear;
  70. display: inline-block;
  71. }
  72. svg.icon-spinner { // TODO: leave only class when iconfont styles are removed
  73. animation: spin-wag 0.5s infinite linear;
  74. }
  75. .icon-horizontalrule:before {
  76. font-family: Open Sans, Arial, sans-serif;
  77. }
  78. .icon-larger:before {
  79. font-size: 1.5em;
  80. }
  81. .icon.text-replace { // iconfont
  82. font-size: 0;
  83. line-height: 0;
  84. overflow: hidden;
  85. &:before {
  86. margin-right: 0;
  87. font-size: 1rem;
  88. display: inline-block;
  89. width: 100%;
  90. line-height: 1.2em;
  91. text-align: center;
  92. vertical-align: middle;
  93. }
  94. }
  95. .text-replace {
  96. font-size: 0;
  97. line-height: 0;
  98. overflow: hidden;
  99. .icon {
  100. @include svg-icon(1rem, middle);
  101. }
  102. }
  103. @keyframes spin-wag {
  104. 0% {
  105. transform: rotate(0deg);
  106. }
  107. 100% {
  108. transform: rotate(360deg);
  109. }
  110. }
  111. .icon-spinner:after {
  112. display: inline-block;
  113. line-height: 1;
  114. }
  115. // CSS-only circled question mark.
  116. // <span class="icon-help-inverse" aria-hidden="true"></span>
  117. .icon-help-inverse {
  118. $size: 15px;
  119. &:before {
  120. display: inline-block;
  121. width: $size;
  122. height: $size;
  123. line-height: $size;
  124. font-size: 1.1em;
  125. text-align: center;
  126. border-radius: 100%;
  127. color: $color-grey-2;
  128. border: 1px solid currentColor;
  129. }
  130. }
  131. // stylelint-disable-next-line no-duplicate-selectors
  132. .icon {
  133. &.initial {
  134. @include svg-icon(1em);
  135. vertical-align: initial;
  136. }
  137. &.default {
  138. @include svg-icon(1.5em);
  139. }
  140. &--flipped {
  141. transform: scaleX(-1);
  142. }
  143. }
  144. .icon.locale-error {
  145. vertical-align: text-top;
  146. margin-right: 0.5em;
  147. width: 1.5em;
  148. height: 1.5em;
  149. color: $color-red;
  150. }
  151. // Media for Windows High Contrast mode
  152. @media (forced-colors: $media-forced-colours) {
  153. .icon {
  154. fill: $system-color-link-text;
  155. }
  156. }