_buttons.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. //
  2. // Buttons
  3. // --------------------------------------------------
  4. // Base styles
  5. // --------------------------------------------------
  6. // Core
  7. .btn {
  8. display: inline-block;
  9. font-weight: $btn-font-weight;
  10. line-height: $btn-line-height;
  11. font-size: $font-size-base;
  12. text-align: center;
  13. vertical-align: middle;
  14. cursor: pointer;
  15. border: none;
  16. @include button-size($btn-padding-y, $btn-padding-x, $font-size-base, $btn-border-radius);
  17. &,
  18. &:active,
  19. &.active {
  20. &:focus,
  21. &.focus {
  22. @include tab-focus();
  23. }
  24. }
  25. @include hover-focus {
  26. text-decoration: none;
  27. }
  28. &.focus {
  29. text-decoration: none;
  30. }
  31. &:active,
  32. &.active {
  33. background-image: none;
  34. outline: 0;
  35. }
  36. &.disabled,
  37. &[disabled],
  38. &:disabled {
  39. cursor: $cursor-disabled;
  40. opacity: 0.65;
  41. @include box-shadow(none);
  42. }
  43. }
  44. // Button Sizes
  45. // --------------------------------------------------
  46. // XLarge
  47. .btn-xlarge {
  48. @include button-size($btn-padding-y-xl, $btn-padding-x-xl, $font-size-lg, $btn-border-radius);
  49. font-weight: normal;
  50. padding-bottom: $btn-padding-y-xl - 3;
  51. .gicon {
  52. font-size: 31px;
  53. margin-right: 1rem;
  54. }
  55. }
  56. // Large
  57. .btn-large {
  58. @include button-size($btn-padding-y-lg, $btn-padding-x-lg, $font-size-lg, $btn-border-radius);
  59. font-weight: normal;
  60. }
  61. .btn-small {
  62. @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $font-size-sm, $btn-border-radius);
  63. }
  64. .btn-mini {
  65. @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $font-size-xs, $btn-border-radius);
  66. }
  67. .btn-link {
  68. color: $btn-link-color;
  69. }
  70. // Set the backgrounds
  71. // -------------------------
  72. .btn-primary {
  73. @include buttonBackground($btn-primary-bg, $btn-primary-bg-hl);
  74. }
  75. .btn-secondary {
  76. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
  77. }
  78. // Warning appears are orange
  79. .btn-warning {
  80. @include buttonBackground($btn-warning-bg, $btn-warning-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. // Success appears as green
  87. .btn-success {
  88. @include buttonBackground($btn-success-bg, $btn-success-bg-hl);
  89. }
  90. // Info appears as a neutral blue
  91. .btn-secondary {
  92. @include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
  93. }
  94. // Inverse appears as dark gray
  95. .btn-inverse {
  96. @include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color, $btn-inverse-text-shadow);
  97. //background: $card-background;
  98. box-shadow: $card-shadow;
  99. //border: 1px solid $tight-form-func-highlight-bg;
  100. }
  101. .btn-transparent {
  102. background-color: transparent;
  103. }
  104. .btn-outline-primary {
  105. @include button-outline-variant($btn-primary-bg);
  106. }
  107. .btn-outline-secondary {
  108. @include button-outline-variant($btn-secondary-bg);
  109. }
  110. .btn-outline-inverse {
  111. @include button-outline-variant($btn-inverse-bg);
  112. }
  113. .btn-outline-success {
  114. @include button-outline-variant($btn-success-bg);
  115. }
  116. .btn-outline-warning {
  117. @include button-outline-variant($btn-warning-bg);
  118. }
  119. .btn-outline-danger {
  120. @include button-outline-variant($btn-danger-bg);
  121. }
  122. .btn-outline-disabled {
  123. @include button-outline-variant($gray-1);
  124. @include box-shadow(none);
  125. cursor: default;
  126. &:hover,
  127. &:active,
  128. &:active:hover,
  129. &:focus {
  130. color: $gray-1;
  131. background-color: transparent;
  132. border-color: $gray-1;
  133. }
  134. }
  135. // Extra padding
  136. .btn-p-x-2 {
  137. padding-left: 20px;
  138. padding-right: 20px;
  139. }
  140. // External services
  141. // Usage:
  142. // <div class="btn btn-service btn-service--facebook">Button text</div>
  143. $btn-service-icon-width: 35px;
  144. .btn-service {
  145. position: relative;
  146. }
  147. @each $service, $data in $external-services {
  148. $serviceBgColor: map-get($data, bgColor);
  149. $serviceBorderColor: map-get($data, borderColor);
  150. .btn-service--#{$service} {
  151. background-color: $serviceBgColor;
  152. border: 1px solid $serviceBorderColor;
  153. .btn-service-icon {
  154. font-size: 24px; // Override
  155. border-right: 1px solid $serviceBorderColor;
  156. }
  157. }
  158. }
  159. .btn-service-icon {
  160. position: absolute;
  161. left: 0;
  162. height: 100%;
  163. top: 0;
  164. padding-left: 0.5rem;
  165. padding-right: 0.5rem;
  166. width: $btn-service-icon-width;
  167. text-align: center;
  168. &::before {
  169. position: relative;
  170. top: 4px;
  171. }
  172. }
  173. .btn-service--grafanacom {
  174. .btn-service-icon {
  175. background-image: url(/public/img/grafana_mask_icon_white.svg);
  176. background-repeat: no-repeat;
  177. background-position: 50%;
  178. background-size: 60%;
  179. }
  180. }