_buttons.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. // Buttons
  2. .btn {
  3. @include control-transition();
  4. appearance: none;
  5. background: $bg-color-light;
  6. border: $border-width solid $primary-color;
  7. border-radius: $border-radius;
  8. color: $primary-color;
  9. cursor: pointer;
  10. display: inline-block;
  11. font-size: $font-size;
  12. height: $control-size;
  13. line-height: $line-height;
  14. outline: none;
  15. padding: $control-padding-y $control-padding-x;
  16. text-align: center;
  17. text-decoration: none;
  18. user-select: none;
  19. vertical-align: middle;
  20. white-space: nowrap;
  21. &:focus {
  22. @include control-shadow();
  23. }
  24. &:focus,
  25. &:hover {
  26. background: $secondary-color;
  27. border-color: $primary-color-dark;
  28. text-decoration: none;
  29. }
  30. &:active,
  31. &.active {
  32. background: $primary-color-dark;
  33. border-color: darken($primary-color-dark, 5%);
  34. color: $light-color;
  35. text-decoration: none;
  36. &.loading {
  37. &::after {
  38. border-bottom-color: $light-color;
  39. border-left-color: $light-color;
  40. }
  41. }
  42. }
  43. &[disabled],
  44. &:disabled,
  45. &.disabled {
  46. cursor: default;
  47. opacity: .5;
  48. pointer-events: none;
  49. }
  50. // Button Primary
  51. &.btn-primary {
  52. background: $primary-color;
  53. border-color: $primary-color-dark;
  54. color: $light-color;
  55. &:focus,
  56. &:hover {
  57. background: darken($primary-color-dark, 2%);
  58. border-color: darken($primary-color-dark, 5%);
  59. color: $light-color;
  60. }
  61. &:active,
  62. &.active {
  63. background: darken($primary-color-dark, 4%);
  64. border-color: darken($primary-color-dark, 7%);
  65. color: $light-color;
  66. }
  67. &.loading {
  68. &::after {
  69. border-bottom-color: $light-color;
  70. border-left-color: $light-color;
  71. }
  72. }
  73. }
  74. // Button Colors
  75. &.btn-success {
  76. @include button-variant($success-color);
  77. }
  78. &.btn-error {
  79. @include button-variant($error-color);
  80. }
  81. // Button Link
  82. &.btn-link {
  83. background: transparent;
  84. border-color: transparent;
  85. color: $link-color;
  86. &:focus,
  87. &:hover,
  88. &:active,
  89. &.active {
  90. color: $link-color-dark;
  91. }
  92. }
  93. // Button Sizes
  94. &.btn-sm {
  95. font-size: $font-size-sm;
  96. height: $control-size-sm;
  97. padding: $control-padding-y-sm $control-padding-x-sm;
  98. }
  99. &.btn-lg {
  100. font-size: $font-size-lg;
  101. height: $control-size-lg;
  102. padding: $control-padding-y-lg $control-padding-x-lg;
  103. }
  104. // Button Block
  105. &.btn-block {
  106. display: block;
  107. width: 100%;
  108. }
  109. // Button Action
  110. &.btn-action {
  111. width: $control-size;
  112. padding-left: 0;
  113. padding-right: 0;
  114. &.btn-sm {
  115. width: $control-size-sm;
  116. }
  117. &.btn-lg {
  118. width: $control-size-lg;
  119. }
  120. }
  121. // Button Clear
  122. &.btn-clear {
  123. background: transparent;
  124. border: 0;
  125. color: currentColor;
  126. height: $unit-4;
  127. line-height: $unit-4;
  128. margin-left: $unit-1;
  129. margin-right: -2px;
  130. opacity: 1;
  131. padding: 0;
  132. text-decoration: none;
  133. width: $unit-4;
  134. &:hover {
  135. opacity: .95;
  136. }
  137. &::before {
  138. content: "\2715";
  139. }
  140. }
  141. }
  142. // Button groups
  143. .btn-group {
  144. display: inline-flex;
  145. flex-wrap: wrap;
  146. .btn {
  147. flex: 1 0 auto;
  148. &:first-child:not(:last-child) {
  149. border-bottom-right-radius: 0;
  150. border-top-right-radius: 0;
  151. }
  152. &:not(:first-child):not(:last-child) {
  153. border-radius: 0;
  154. margin-left: -$border-width;
  155. }
  156. &:last-child:not(:first-child) {
  157. border-bottom-left-radius: 0;
  158. border-top-left-radius: 0;
  159. margin-left: -$border-width;
  160. }
  161. &:focus,
  162. &:hover,
  163. &:active,
  164. &.active {
  165. z-index: $zindex-0;
  166. }
  167. }
  168. &.btn-group-block {
  169. display: flex;
  170. .btn {
  171. flex: 1 0 0;
  172. }
  173. }
  174. }