No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_buttons.scss 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Button variants
  2. //
  3. // Easily pump out default styles, as well as :hover, :focus, :active,
  4. // and disabled options for all buttons
  5. @mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) {
  6. color: color-yiq($background);
  7. @include gradient-bg($background);
  8. border-color: $border;
  9. @include box-shadow($btn-box-shadow);
  10. @include hover {
  11. color: color-yiq($hover-background);
  12. @include gradient-bg($hover-background);
  13. border-color: $hover-border;
  14. }
  15. &:focus,
  16. &.focus {
  17. // Avoid using mixin so we can pass custom focus shadow properly
  18. @if $enable-shadows {
  19. box-shadow: $btn-box-shadow, 0 0 0 $btn-focus-width rgba($border, .5);
  20. } @else {
  21. box-shadow: 0 0 0 $btn-focus-width rgba($border, .5);
  22. }
  23. }
  24. // Disabled comes first so active can properly restyle
  25. &.disabled,
  26. &:disabled {
  27. color: color-yiq($background);
  28. background-color: $background;
  29. border-color: $border;
  30. }
  31. &:not(:disabled):not(.disabled):active,
  32. &:not(:disabled):not(.disabled).active,
  33. .show > &.dropdown-toggle {
  34. color: color-yiq($active-background);
  35. background-color: $active-background;
  36. @if $enable-gradients {
  37. background-image: none; // Remove the gradient for the pressed/active state
  38. }
  39. border-color: $active-border;
  40. &:focus {
  41. // Avoid using mixin so we can pass custom focus shadow properly
  42. @if $enable-shadows {
  43. box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($border, .5);
  44. } @else {
  45. box-shadow: 0 0 0 $btn-focus-width rgba($border, .5);
  46. }
  47. }
  48. }
  49. }
  50. @mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
  51. color: $color;
  52. background-color: transparent;
  53. background-image: none;
  54. border-color: $color;
  55. &:hover {
  56. color: $color-hover;
  57. background-color: $active-background;
  58. border-color: $active-border;
  59. }
  60. &:focus,
  61. &.focus {
  62. box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
  63. }
  64. &.disabled,
  65. &:disabled {
  66. color: $color;
  67. background-color: transparent;
  68. }
  69. &:not(:disabled):not(.disabled):active,
  70. &:not(:disabled):not(.disabled).active,
  71. .show > &.dropdown-toggle {
  72. color: color-yiq($active-background);
  73. background-color: $active-background;
  74. border-color: $active-border;
  75. &:focus {
  76. // Avoid using mixin so we can pass custom focus shadow properly
  77. @if $enable-shadows and $btn-active-box-shadow != none {
  78. box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5);
  79. } @else {
  80. box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
  81. }
  82. }
  83. }
  84. }
  85. // Button sizes
  86. @mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
  87. padding: $padding-y $padding-x;
  88. font-size: $font-size;
  89. line-height: $line-height;
  90. // Manually declare to provide an override to the browser default
  91. @if $enable-rounded {
  92. border-radius: $border-radius;
  93. } @else {
  94. border-radius: 0;
  95. }
  96. }