_buttons.scss 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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;
  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. }
  46. }
  47. // Button Sizes
  48. // --------------------------------------------------
  49. // Large
  50. .btn-large {
  51. @include button-size($btn-padding-y-lg, $space-lg, $font-size-lg, $border-radius-sm);
  52. font-weight: normal;
  53. height: $height-lg;
  54. .gicon {
  55. //font-size: 31px;
  56. margin-right: $space-sm;
  57. filter: brightness(100);
  58. }
  59. }
  60. .btn-small {
  61. @include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
  62. height: $height-sm;
  63. }
  64. // Deprecated, only used by old plugins
  65. .btn-mini {
  66. @include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
  67. height: $height-sm;
  68. }
  69. .btn-link {
  70. color: $btn-link-color;
  71. background: transparent;
  72. }
  73. // Set the backgrounds
  74. // -------------------------
  75. .btn-success,
  76. .btn-primary {
  77. @include buttonBackground($btn-primary-bg, $btn-primary-bg-hl);
  78. }
  79. .btn-secondary {
  80. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
  81. }
  82. // Danger and error appear as red
  83. .btn-danger {
  84. @include buttonBackground($btn-danger-bg, $btn-danger-bg-hl);
  85. }
  86. // Info appears as a neutral blue
  87. .btn-secondary {
  88. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
  89. // Inverse appears as dark gray
  90. }
  91. .btn-inverse {
  92. @include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color, $btn-inverse-text-shadow);
  93. //background: $card-background;
  94. box-shadow: $card-shadow;
  95. //border: 1px solid $tight-form-func-highlight-bg;
  96. }
  97. .btn-transparent {
  98. background-color: transparent;
  99. }
  100. .btn-outline-primary {
  101. @include button-outline-variant($btn-primary-bg);
  102. }
  103. .btn-outline-secondary {
  104. @include button-outline-variant($btn-secondary-bg-hl);
  105. }
  106. .btn-outline-inverse {
  107. @include button-outline-variant($btn-inverse-bg);
  108. }
  109. .btn-outline-danger {
  110. @include button-outline-variant($btn-danger-bg);
  111. }
  112. .btn-outline-disabled {
  113. @include button-outline-variant($gray-1);
  114. @include box-shadow(none);
  115. cursor: default;
  116. &:hover,
  117. &:active,
  118. &:active:hover,
  119. &:focus {
  120. color: $gray-1;
  121. background-color: transparent;
  122. border-color: $gray-1;
  123. }
  124. }
  125. // Extra padding
  126. .btn-p-x-2 {
  127. padding-left: 20px;
  128. padding-right: 20px;
  129. }
  130. // No horizontal padding
  131. .btn-p-x-0 {
  132. padding-left: 0;
  133. padding-right: 0;
  134. }
  135. // External services
  136. // Usage:
  137. // <div class="btn btn-service btn-service--facebook">Button text</div>
  138. $btn-service-icon-width: 35px;
  139. .btn-service {
  140. position: relative;
  141. }
  142. @each $service, $data in $external-services {
  143. $serviceBgColor: map-get($data, bgColor);
  144. $serviceBorderColor: map-get($data, borderColor);
  145. .btn-service--#{$service} {
  146. background-color: $serviceBgColor;
  147. border: 1px solid $serviceBorderColor;
  148. .btn-service-icon {
  149. font-size: 24px; // Override
  150. border-right: 1px solid $serviceBorderColor;
  151. }
  152. }
  153. }
  154. .btn-service-icon {
  155. position: absolute;
  156. left: 0;
  157. height: 100%;
  158. top: 0;
  159. padding-left: $space-sm;
  160. padding-right: $space-sm;
  161. width: $btn-service-icon-width;
  162. text-align: center;
  163. &::before {
  164. position: relative;
  165. top: 4px;
  166. }
  167. }
  168. .btn-service--grafanacom {
  169. .btn-service-icon {
  170. background-image: url(/public/img/grafana_mask_icon_white.svg);
  171. background-repeat: no-repeat;
  172. background-position: 50%;
  173. background-size: 60%;
  174. }
  175. }
  176. //Toggle button
  177. .toggle-btn {
  178. background: $input-label-bg;
  179. color: $text-color-weak;
  180. box-shadow: $card-shadow;
  181. &:first-child {
  182. border-radius: 2px 0 0 2px;
  183. margin: 0;
  184. }
  185. &:last-child {
  186. border-radius: 0 2px 2px 0;
  187. margin-left: 0 !important;
  188. }
  189. &.active {
  190. background-color: lighten($input-label-bg, 5%);
  191. color: $link-color;
  192. &:hover {
  193. cursor: default;
  194. }
  195. }
  196. }
  197. //Button animations
  198. .btn-loading span {
  199. animation-name: blink;
  200. animation-duration: 1.4s;
  201. animation-iteration-count: infinite;
  202. animation-fill-mode: both;
  203. }
  204. .btn-loading span:nth-child(2) {
  205. animation-delay: 0.2s;
  206. }
  207. .btn-loading span:nth-child(3) {
  208. animation-delay: 0.4s;
  209. }
  210. @keyframes blink {
  211. 0% {
  212. opacity: 0.2;
  213. font-size: 14;
  214. }
  215. 20% {
  216. opacity: 1;
  217. font-size: 18;
  218. }
  219. 100% {
  220. opacity: 0.2;
  221. font-size: 14;
  222. }
  223. }