_icons.scss 3.8 KB

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