_buttons.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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-outline-primary {
  102. @include button-outline-variant($btn-primary-bg);
  103. }
  104. .btn-outline-secondary {
  105. @include button-outline-variant($btn-secondary-bg);
  106. }
  107. .btn-outline-inverse {
  108. @include button-outline-variant($btn-inverse-bg);
  109. }
  110. .btn-outline-success {
  111. @include button-outline-variant($btn-success-bg);
  112. }
  113. .btn-outline-warning {
  114. @include button-outline-variant($btn-warning-bg);
  115. }
  116. .btn-outline-danger {
  117. @include button-outline-variant($btn-danger-bg);
  118. }
  119. .btn-outline-disabled {
  120. @include button-outline-variant($gray-1);
  121. @include box-shadow(none);
  122. cursor: default;
  123. &:hover,
  124. &:active,
  125. &:active:hover,
  126. &:focus {
  127. color: $gray-1;
  128. background-color: transparent;
  129. border-color: $gray-1;
  130. }
  131. }
  132. // Extra padding
  133. .btn-p-x-2 {
  134. padding-left: 20px;
  135. padding-right: 20px;
  136. }
  137. // External services
  138. // Usage:
  139. // <div class="btn btn-service btn-service--facebook">Button text</div>
  140. $btn-service-icon-width: 35px;
  141. .btn-service {
  142. position: relative;
  143. }
  144. @each $service, $data in $external-services {
  145. $serviceBgColor: map-get($data, bgColor);
  146. $serviceBorderColor: map-get($data, borderColor);
  147. .btn-service--#{$service} {
  148. background-color: $serviceBgColor;
  149. border: 1px solid $serviceBorderColor;
  150. .btn-service-icon {
  151. font-size: 24px; // Override
  152. border-right: 1px solid $serviceBorderColor;
  153. }
  154. }
  155. }
  156. .btn-service-icon {
  157. position: absolute;
  158. left: 0;
  159. height: 100%;
  160. top: 0;
  161. padding-left: 0.5rem;
  162. padding-right: 0.5rem;
  163. width: $btn-service-icon-width;
  164. text-align: center;
  165. &::before {
  166. position: relative;
  167. top: 4px;
  168. }
  169. }
  170. .btn-service--grafanacom {
  171. .btn-service-icon {
  172. background-image: url(/public/img/grafana_mask_icon_white.svg);
  173. background-repeat: no-repeat;
  174. background-position: 50%;
  175. background-size: 60%;
  176. }
  177. }