_buttons.scss 5.1 KB

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