_buttons.scss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. // Buttons
  2. .btn {
  3. appearance: none;
  4. background: $bg-color-light;
  5. border: $border-width solid $primary-color;
  6. border-radius: $border-radius;
  7. color: $primary-color;
  8. cursor: pointer;
  9. display: inline-block;
  10. font-size: $font-size;
  11. height: $control-size;
  12. line-height: $line-height;
  13. outline: none;
  14. padding: $control-padding-y $control-padding-x;
  15. text-align: center;
  16. text-decoration: none;
  17. transition: background .2s, border .2s, box-shadow .2s, color .2s;
  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-5;
  127. line-height: $unit-4;
  128. margin-left: $unit-1;
  129. margin-right: -2px;
  130. opacity: 1;
  131. padding: $unit-h;
  132. text-decoration: none;
  133. width: $unit-5;
  134. &:focus,
  135. &:hover {
  136. background: rgba($bg-color, .5);
  137. opacity: .95;
  138. }
  139. &::before {
  140. content: "\2715";
  141. }
  142. }
  143. }
  144. // Button groups
  145. .btn-group {
  146. display: inline-flex;
  147. flex-wrap: wrap;
  148. .btn {
  149. flex: 1 0 auto;
  150. &:first-child:not(:last-child) {
  151. border-bottom-right-radius: 0;
  152. border-top-right-radius: 0;
  153. }
  154. &:not(:first-child):not(:last-child) {
  155. border-radius: 0;
  156. margin-left: -$border-width;
  157. }
  158. &:last-child:not(:first-child) {
  159. border-bottom-left-radius: 0;
  160. border-top-left-radius: 0;
  161. margin-left: -$border-width;
  162. }
  163. &:focus,
  164. &:hover,
  165. &:active,
  166. &.active {
  167. z-index: $zindex-0;
  168. }
  169. }
  170. &.btn-group-block {
  171. display: flex;
  172. .btn {
  173. flex: 1 0 0;
  174. }
  175. }
  176. }