_buttons.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. &.btn-warning {
  82. @include button-variant($warning-color);
  83. }
  84. // Button Link
  85. &.btn-link {
  86. background: transparent;
  87. border-color: transparent;
  88. color: $link-color;
  89. &:focus,
  90. &:hover,
  91. &:active,
  92. &.active {
  93. color: $link-color-dark;
  94. }
  95. }
  96. // Button Sizes
  97. &.btn-sm {
  98. font-size: $font-size-sm;
  99. height: $control-size-sm;
  100. padding: $control-padding-y-sm $control-padding-x-sm;
  101. }
  102. &.btn-lg {
  103. font-size: $font-size-lg;
  104. height: $control-size-lg;
  105. padding: $control-padding-y-lg $control-padding-x-lg;
  106. }
  107. // Button Block
  108. &.btn-block {
  109. display: block;
  110. width: 100%;
  111. }
  112. // Button Action
  113. &.btn-action {
  114. width: $control-size;
  115. padding-left: 0;
  116. padding-right: 0;
  117. &.btn-sm {
  118. width: $control-size-sm;
  119. }
  120. &.btn-lg {
  121. width: $control-size-lg;
  122. }
  123. }
  124. // Button Clear
  125. &.btn-clear {
  126. background: transparent;
  127. border: 0;
  128. color: currentColor;
  129. height: $unit-4;
  130. line-height: $unit-4;
  131. margin-left: $unit-1;
  132. margin-right: -2px;
  133. opacity: 1;
  134. padding: 0;
  135. text-decoration: none;
  136. width: $unit-4;
  137. &:hover {
  138. opacity: .95;
  139. }
  140. &::before {
  141. content: "\2715";
  142. }
  143. }
  144. }
  145. // Button groups
  146. .btn-group {
  147. display: inline-flex;
  148. flex-wrap: wrap;
  149. .btn {
  150. flex: 1 0 auto;
  151. &:first-child:not(:last-child) {
  152. border-bottom-right-radius: 0;
  153. border-top-right-radius: 0;
  154. }
  155. &:not(:first-child):not(:last-child) {
  156. border-radius: 0;
  157. margin-left: -$border-width;
  158. }
  159. &:last-child:not(:first-child) {
  160. border-bottom-left-radius: 0;
  161. border-top-left-radius: 0;
  162. margin-left: -$border-width;
  163. }
  164. &:focus,
  165. &:hover,
  166. &:active,
  167. &.active {
  168. z-index: $zindex-0;
  169. }
  170. }
  171. &.btn-group-block {
  172. display: flex;
  173. .btn {
  174. flex: 1 0 0;
  175. }
  176. }
  177. }