_buttons.scss 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. //
  2. // Buttons
  3. // --------------------------------------------------
  4. // Base styles
  5. // --------------------------------------------------
  6. // Core
  7. .btn {
  8. display: inline-flex;
  9. align-items: center;
  10. justify-content: center;
  11. font-weight: $btn-font-weight;
  12. line-height: $btn-line-height;
  13. font-size: $font-size-base;
  14. text-align: center;
  15. vertical-align: middle;
  16. cursor: pointer;
  17. border: none;
  18. height: $height-md + px;
  19. @include button-size($btn-padding-y, $space-md, $font-size-base, $border-radius-sm);
  20. &,
  21. &:active,
  22. &.active {
  23. &:focus,
  24. &.focus {
  25. @include no-focus();
  26. }
  27. }
  28. @include hover-focus {
  29. text-decoration: none;
  30. }
  31. &.focus {
  32. text-decoration: none;
  33. }
  34. &:active,
  35. &.active {
  36. background-image: none;
  37. outline: 0;
  38. }
  39. &.disabled,
  40. &[disabled],
  41. &:disabled {
  42. cursor: $cursor-disabled;
  43. opacity: 0.65;
  44. @include box-shadow(none);
  45. pointer-events: none;
  46. }
  47. &--radius-left-0 {
  48. border-top-left-radius: 0;
  49. border-bottom-left-radius: 0;
  50. }
  51. &--radius-right-0 {
  52. border-top-right-radius: 0;
  53. border-bottom-right-radius: 0;
  54. }
  55. }
  56. // Button Sizes
  57. // --------------------------------------------------
  58. // Large
  59. .btn-large {
  60. @include button-size($btn-padding-y-lg, $space-lg, $font-size-lg, $border-radius-sm);
  61. font-weight: normal;
  62. height: $height-lg + px;
  63. .gicon {
  64. //font-size: 31px;
  65. margin-right: $space-sm;
  66. filter: brightness(100);
  67. }
  68. }
  69. .btn-small {
  70. @include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
  71. height: $height-sm + px;
  72. }
  73. // Deprecated, only used by old plugins
  74. .btn-mini {
  75. @include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
  76. height: #{height-sm}px;
  77. }
  78. .btn-link {
  79. color: $btn-link-color;
  80. background: transparent;
  81. }
  82. // Set the backgrounds
  83. // -------------------------
  84. .btn-success,
  85. .btn-primary {
  86. @include buttonBackground($btn-primary-bg, $btn-primary-bg-hl);
  87. }
  88. .btn-secondary {
  89. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
  90. }
  91. // Danger and error appear as red
  92. .btn-danger {
  93. @include buttonBackground($btn-danger-bg, $btn-danger-bg-hl);
  94. }
  95. // Info appears as a neutral blue
  96. .btn-secondary {
  97. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl, $text-color);
  98. // Inverse appears as dark gray
  99. }
  100. .btn-inverse {
  101. @include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color, $btn-inverse-text-shadow);
  102. //background: $card-background;
  103. box-shadow: $card-shadow;
  104. //border: 1px solid $tight-form-func-highlight-bg;
  105. }
  106. .btn-transparent {
  107. background-color: transparent;
  108. }
  109. .btn-outline-primary {
  110. @include button-outline-variant($btn-primary-bg);
  111. }
  112. .btn-outline-secondary {
  113. @include button-outline-variant($btn-secondary-bg-hl);
  114. }
  115. .btn-outline-inverse {
  116. @include button-outline-variant($btn-inverse-bg);
  117. }
  118. .btn-outline-danger {
  119. @include button-outline-variant($btn-danger-bg);
  120. }
  121. .btn-outline-disabled {
  122. @include button-outline-variant($gray-1);
  123. @include box-shadow(none);
  124. cursor: default;
  125. &:hover,
  126. &:active,
  127. &:active:hover,
  128. &:focus {
  129. color: $gray-1;
  130. background-color: transparent;
  131. border-color: $gray-1;
  132. }
  133. }
  134. // Extra padding
  135. .btn-p-x-2 {
  136. padding-left: 20px;
  137. padding-right: 20px;
  138. }
  139. // No horizontal padding
  140. .btn-p-x-0 {
  141. padding-left: 0;
  142. padding-right: 0;
  143. }
  144. // External services
  145. // Usage:
  146. // <div class="btn btn-service btn-service--facebook">Button text</div>
  147. $btn-service-icon-width: 35px;
  148. .btn-service {
  149. position: relative;
  150. }
  151. @each $service, $data in $external-services {
  152. $serviceBgColor: map-get($data, bgColor);
  153. $serviceBorderColor: map-get($data, borderColor);
  154. .btn-service--#{$service} {
  155. background-color: $serviceBgColor;
  156. border: 1px solid $serviceBorderColor;
  157. .btn-service-icon {
  158. font-size: 24px; // Override
  159. border-right: 1px solid $serviceBorderColor;
  160. }
  161. }
  162. }
  163. .btn-service-icon {
  164. position: absolute;
  165. left: 0;
  166. height: 100%;
  167. top: 0;
  168. padding-left: $space-sm;
  169. padding-right: $space-sm;
  170. width: $btn-service-icon-width;
  171. text-align: center;
  172. &::before {
  173. position: relative;
  174. top: 4px;
  175. }
  176. }
  177. .btn-service--grafanacom {
  178. .btn-service-icon {
  179. background-image: url(../img/grafana_mask_icon_white.svg);
  180. background-repeat: no-repeat;
  181. background-position: 50%;
  182. background-size: 60%;
  183. }
  184. }
  185. .btn-service--azuread {
  186. .btn-service-icon {
  187. background-image: url(../img/microsoft_auth_icon.svg);
  188. background-repeat: no-repeat;
  189. background-position: 50%;
  190. background-size: 60%;
  191. }
  192. }
  193. .btn-service--okta {
  194. .btn-service-icon {
  195. background-image: url(../img/okta_logo_white.png);
  196. background-repeat: no-repeat;
  197. background-position: 50%;
  198. background-size: 60%;
  199. }
  200. }
  201. //Toggle button
  202. .toggle-btn {
  203. background: $input-label-bg;
  204. color: $text-color-weak;
  205. box-shadow: $card-shadow;
  206. &:first-child {
  207. border-radius: 2px 0 0 2px;
  208. margin: 0;
  209. }
  210. &:last-child {
  211. border-radius: 0 2px 2px 0;
  212. margin-left: 0 !important;
  213. }
  214. &.active {
  215. background-color: lighten($input-label-bg, 5%);
  216. color: $link-color;
  217. &:hover {
  218. cursor: default;
  219. }
  220. }
  221. }
  222. //Button animations
  223. .btn-loading span {
  224. animation-name: blink;
  225. animation-duration: 1.4s;
  226. animation-iteration-count: infinite;
  227. animation-fill-mode: both;
  228. }
  229. .btn-loading span:nth-child(2) {
  230. animation-delay: 0.2s;
  231. }
  232. .btn-loading span:nth-child(3) {
  233. animation-delay: 0.4s;
  234. }
  235. @keyframes blink {
  236. 0% {
  237. opacity: 0.2;
  238. font-size: 14;
  239. }
  240. 20% {
  241. opacity: 1;
  242. font-size: 18;
  243. }
  244. 100% {
  245. opacity: 0.2;
  246. font-size: 14;
  247. }
  248. }