button.scss 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. .btn {
  2. // Focus style for all buttons
  3. --bs-btn-focus-box-shadow: 0 0 0 2px var(--border-active-dark);
  4. &:focus-visible {
  5. background-color: var(--bs-btn-bg);
  6. }
  7. // Sizes
  8. // Default size
  9. @include ol-button-size(
  10. $font-size: var(--font-size-03),
  11. $line-height: var(--line-height-03),
  12. $padding-y: var(--spacing-03)
  13. );
  14. &.btn-lg {
  15. @include ol-button-size(
  16. $font-size: var(--font-size-03),
  17. $line-height: var(--line-height-03),
  18. $padding-y: var(--spacing-05)
  19. );
  20. }
  21. &.btn-sm {
  22. @include ol-button-size(
  23. $font-size: var(--font-size-02),
  24. $line-height: var(--line-height-02),
  25. $padding-y: var(--spacing-01),
  26. $padding-x: var(--spacing-05)
  27. );
  28. }
  29. // Variants
  30. &.btn-primary {
  31. @include ol-button-variant(
  32. $color: var(--white),
  33. $background: var(--bg-accent-01),
  34. $hover-background: var(--bg-accent-02),
  35. $hover-border: var(--bg-accent-02)
  36. );
  37. }
  38. &.btn-secondary {
  39. @include ol-button-variant(
  40. $color: var(--content-primary),
  41. $background: var(--bg-light-primary),
  42. $border: var(--border-primary),
  43. $hover-background: var(--bg-light-tertiary),
  44. $hover-border: var(--border-primary),
  45. $borderless: false
  46. );
  47. }
  48. &.btn-ghost {
  49. @include ol-button-variant(
  50. $color: var(--content-primary),
  51. $background: var(--bg-light-primary),
  52. $hover-background: var(--bg-light-tertiary)
  53. );
  54. }
  55. &.btn-danger {
  56. @include ol-button-variant(
  57. $color: var(--white),
  58. $background: var(--bg-danger-01),
  59. $border: var(--bg-danger-01),
  60. $hover-background: var(--bg-danger-02)
  61. );
  62. }
  63. &.btn-danger-ghost {
  64. @include ol-button-variant(
  65. $color: var(--content-danger),
  66. $background: var(--bg-light-primary),
  67. $hover-background: var(--bg-danger-03)
  68. );
  69. }
  70. &.btn-premium {
  71. @include ol-button-variant(
  72. $color: var(--white),
  73. $background: var(--blue-70)
  74. );
  75. background: var(--premium-gradient);
  76. transition: none;
  77. &:hover {
  78. background: var(--blue-70);
  79. }
  80. }
  81. &.btn-premium-secondary {
  82. @include ol-button-variant(
  83. $color: var(--blue-60),
  84. $background: var(--bg-light-primary),
  85. $border: var(--blue-60),
  86. $hover-background: var(--bg-info-03),
  87. $hover-border: var(--blue-60),
  88. $borderless: false
  89. );
  90. }
  91. &.btn-blue {
  92. @include ol-button-variant(
  93. $color: var(--white),
  94. $background: var(--sapphire-blue),
  95. $border: var(--sapphire-blue),
  96. $hover-background: (
  97. var(--sapphire-blue-dark),
  98. ),
  99. $hover-border: (
  100. var(--sapphire-blue-dark),
  101. ),
  102. $borderless: false
  103. );
  104. }
  105. &.btn-social {
  106. @extend .btn-secondary;
  107. padding-left: var(--spacing-03);
  108. .btn-social-icon {
  109. height: 24px;
  110. width: 24px;
  111. padding: var(--spacing-01);
  112. margin-right: var(--spacing-02);
  113. }
  114. }
  115. }
  116. // Link buttons
  117. // -------------------------
  118. // Make a button look and behave like a link
  119. .btn-link {
  120. color: var(--link-color);
  121. font-weight: normal;
  122. cursor: pointer;
  123. text-decoration: underline;
  124. font-size: inherit;
  125. vertical-align: inherit;
  126. border-radius: 0;
  127. &,
  128. &:active,
  129. &[disabled],
  130. fieldset[disabled] & {
  131. background-color: transparent;
  132. @include box-shadow(none);
  133. }
  134. &:hover,
  135. &:focus {
  136. color: var(--link-hover-color);
  137. text-decoration: none;
  138. background-color: transparent;
  139. }
  140. &.btn-danger {
  141. color: var(--content-danger);
  142. // since it's a link, override the button states
  143. &:active {
  144. color: var(--content-danger);
  145. background-color: transparent;
  146. }
  147. &:focus-visible {
  148. background-color: transparent;
  149. outline: -webkit-focus-ring-color auto 1px;
  150. }
  151. }
  152. }
  153. .btn-inline-link {
  154. @extend .btn-link;
  155. font-size: inherit;
  156. padding: 0;
  157. vertical-align: inherit;
  158. }
  159. .button-loading {
  160. align-items: center;
  161. display: inline-grid;
  162. grid-template-areas: 'container'; // Define a single grid area
  163. pointer-events: none;
  164. }
  165. .button-loading > * {
  166. grid-area: container; // Position all the direct children within the single grid area
  167. }
  168. .button-loading .spinner-container {
  169. display: flex;
  170. justify-content: center;
  171. align-items: center;
  172. .loading-spinner-small {
  173. border-width: 0.2em;
  174. height: 1.25rem;
  175. width: 1.25rem;
  176. }
  177. .loading-spinner-large {
  178. border-width: 0.2em;
  179. height: 1.5rem;
  180. width: 1.5rem;
  181. }
  182. }
  183. // Hide the text when the spinner is visible
  184. .button-loading > [aria-hidden='true'] {
  185. visibility: hidden;
  186. }
  187. .button-content {
  188. display: inline-flex;
  189. align-items: center;
  190. gap: var(--spacing-04); // Add gap between text and icons
  191. justify-content: center;
  192. .icon-small {
  193. font-size: 1.25rem;
  194. }
  195. .icon-large {
  196. font-size: 1.5rem;
  197. }
  198. .spinner {
  199. margin: var(--spacing-01);
  200. }
  201. }
  202. .icon-button-small {
  203. padding: var(--spacing-01);
  204. }
  205. .icon-button {
  206. padding: var(--spacing-04);
  207. }
  208. .icon-button-large {
  209. padding: var(--spacing-05);
  210. }
  211. // Set the visited colour for a link that is styled as a button. This is necessary because we have a generic rule that
  212. // sets the colour of visited links
  213. a.btn:visited {
  214. color: var(--bs-btn-color);
  215. }
  216. // Copy icon button
  217. .copy-button {
  218. text-decoration: none;
  219. }
  220. .btn-reset {
  221. @include reset-button;
  222. }
  223. .btn-transparent {
  224. background: none !important;
  225. border-radius: 0 !important;
  226. color: inherit !important;
  227. font-weight: 400;
  228. &:hover {
  229. background: none !important;
  230. color: inherit !important;
  231. }
  232. }