_icons.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. @include icon(); // from _mixins.scss
  23. }
  24. // stylelint-disable-next-line no-duplicate-selectors
  25. .icon:after {
  26. text-align: right;
  27. }
  28. // =============================================================================
  29. // Icon factory methods
  30. // =============================================================================
  31. @each $icon, $content in $icons {
  32. .icon-#{$icon}:before {
  33. content: string.quote(#{$content});
  34. }
  35. }
  36. @each $icon, $content in $icons-after {
  37. .icon-#{$icon}:after {
  38. content: string.quote(#{$content});
  39. }
  40. }
  41. // =============================================================================
  42. // Custom config for various icons
  43. // =============================================================================
  44. .icon-download {
  45. // Credit: Icon made by Freepik from Flaticon.com
  46. }
  47. .icon-view:before,
  48. .icon-no-view:before {
  49. // icon-font
  50. vertical-align: -3.5px;
  51. font-size: 1.1rem;
  52. }
  53. .icon-spinner:after,
  54. .icon-spinner:before {
  55. // iconfont
  56. width: 1em;
  57. animation: spin-wag 0.5s infinite linear;
  58. display: inline-block;
  59. }
  60. svg.icon-spinner {
  61. // TODO: leave only class when iconfont styles are removed
  62. animation: spin-wag 0.5s infinite linear;
  63. }
  64. .icon-horizontalrule:before {
  65. font-family: $font-sans;
  66. }
  67. .icon-larger:before {
  68. font-size: 1.5em;
  69. }
  70. .icon.text-replace {
  71. // iconfont
  72. font-size: 0;
  73. line-height: 0;
  74. overflow: hidden;
  75. &:before {
  76. margin-right: 0;
  77. font-size: 1rem;
  78. display: inline-block;
  79. width: 100%;
  80. line-height: 1.2em;
  81. text-align: center;
  82. vertical-align: middle;
  83. }
  84. }
  85. .text-replace {
  86. font-size: 0;
  87. line-height: 0;
  88. overflow: hidden;
  89. .icon {
  90. @include svg-icon(1rem, middle);
  91. }
  92. }
  93. @keyframes spin-wag {
  94. 0% {
  95. transform: rotate(0deg);
  96. }
  97. 100% {
  98. transform: rotate(360deg);
  99. }
  100. }
  101. .icon-spinner:after {
  102. display: inline-block;
  103. line-height: 1;
  104. }
  105. // CSS-only circled question mark.
  106. // <span class="icon-help-inverse" aria-hidden="true"></span>
  107. .icon-help-inverse {
  108. $size: 15px;
  109. &:before {
  110. display: inline-block;
  111. width: $size;
  112. height: $size;
  113. line-height: $size;
  114. font-size: 1.1em;
  115. text-align: center;
  116. border-radius: 100%;
  117. color: $color-grey-2;
  118. border: 1px solid currentColor;
  119. }
  120. }
  121. // stylelint-disable-next-line no-duplicate-selectors
  122. .icon {
  123. &.initial {
  124. @include svg-icon(1em);
  125. vertical-align: initial;
  126. }
  127. &.default {
  128. @include svg-icon(1.5em);
  129. }
  130. &--flipped {
  131. transform: scaleX(-1);
  132. }
  133. }
  134. .icon.locale-error {
  135. vertical-align: text-top;
  136. margin-right: 0.5em;
  137. width: 1.5em;
  138. height: 1.5em;
  139. color: $color-red;
  140. }
  141. // Media for Windows High Contrast mode
  142. @media (forced-colors: $media-forced-colours) {
  143. .icon {
  144. fill: $system-color-link-text;
  145. }
  146. }