_buttons.scss 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. 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;
  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;
  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;
  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);
  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(/public/img/grafana_mask_icon_white.svg);
  180. background-repeat: no-repeat;
  181. background-position: 50%;
  182. background-size: 60%;
  183. }
  184. }
  185. //Toggle button
  186. .toggle-btn {
  187. background: $input-label-bg;
  188. color: $text-color-weak;
  189. box-shadow: $card-shadow;
  190. &:first-child {
  191. border-radius: 2px 0 0 2px;
  192. margin: 0;
  193. }
  194. &:last-child {
  195. border-radius: 0 2px 2px 0;
  196. margin-left: 0 !important;
  197. }
  198. &.active {
  199. background-color: lighten($input-label-bg, 5%);
  200. color: $link-color;
  201. &:hover {
  202. cursor: default;
  203. }
  204. }
  205. }
  206. //Button animations
  207. .btn-loading span {
  208. animation-name: blink;
  209. animation-duration: 1.4s;
  210. animation-iteration-count: infinite;
  211. animation-fill-mode: both;
  212. }
  213. .btn-loading span:nth-child(2) {
  214. animation-delay: 0.2s;
  215. }
  216. .btn-loading span:nth-child(3) {
  217. animation-delay: 0.4s;
  218. }
  219. @keyframes blink {
  220. 0% {
  221. opacity: 0.2;
  222. font-size: 14;
  223. }
  224. 20% {
  225. opacity: 1;
  226. font-size: 18;
  227. }
  228. 100% {
  229. opacity: 0.2;
  230. font-size: 14;
  231. }
  232. }