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.

70 lines
3.1 KiB

9 months ago
  1. // Button variants
  2. //
  3. // Easily pump out default styles, as well as :hover, :focus, :active,
  4. // and disabled options for all buttons
  5. // scss-docs-start btn-variant-mixin
  6. @mixin button-variant(
  7. $background,
  8. $border,
  9. $color: color-contrast($background),
  10. $hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
  11. $hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
  12. $hover-color: color-contrast($hover-background),
  13. $active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
  14. $active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
  15. $active-color: color-contrast($active-background),
  16. $disabled-background: $background,
  17. $disabled-border: $border,
  18. $disabled-color: color-contrast($disabled-background)
  19. ) {
  20. --#{$prefix}btn-color: #{$color};
  21. --#{$prefix}btn-bg: #{$background};
  22. --#{$prefix}btn-border-color: #{$border};
  23. --#{$prefix}btn-hover-color: #{$hover-color};
  24. --#{$prefix}btn-hover-bg: #{$hover-background};
  25. --#{$prefix}btn-hover-border-color: #{$hover-border};
  26. --#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix($color, $border, 15%))};
  27. --#{$prefix}btn-active-color: #{$active-color};
  28. --#{$prefix}btn-active-bg: #{$active-background};
  29. --#{$prefix}btn-active-border-color: #{$active-border};
  30. --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
  31. --#{$prefix}btn-disabled-color: #{$disabled-color};
  32. --#{$prefix}btn-disabled-bg: #{$disabled-background};
  33. --#{$prefix}btn-disabled-border-color: #{$disabled-border};
  34. }
  35. // scss-docs-end btn-variant-mixin
  36. // scss-docs-start btn-outline-variant-mixin
  37. @mixin button-outline-variant(
  38. $color,
  39. $color-hover: color-contrast($color),
  40. $active-background: $color,
  41. $active-border: $color,
  42. $active-color: color-contrast($active-background)
  43. ) {
  44. --#{$prefix}btn-color: #{$color};
  45. --#{$prefix}btn-border-color: #{$color};
  46. --#{$prefix}btn-hover-color: #{$color-hover};
  47. --#{$prefix}btn-hover-bg: #{$active-background};
  48. --#{$prefix}btn-hover-border-color: #{$active-border};
  49. --#{$prefix}btn-focus-shadow-rgb: #{to-rgb($color)};
  50. --#{$prefix}btn-active-color: #{$active-color};
  51. --#{$prefix}btn-active-bg: #{$active-background};
  52. --#{$prefix}btn-active-border-color: #{$active-border};
  53. --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
  54. --#{$prefix}btn-disabled-color: #{$color};
  55. --#{$prefix}btn-disabled-bg: transparent;
  56. --#{$prefix}btn-disabled-border-color: #{$color};
  57. --#{$prefix}gradient: none;
  58. }
  59. // scss-docs-end btn-outline-variant-mixin
  60. // scss-docs-start btn-size-mixin
  61. @mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
  62. --#{$prefix}btn-padding-y: #{$padding-y};
  63. --#{$prefix}btn-padding-x: #{$padding-x};
  64. @include rfs($font-size, --#{$prefix}btn-font-size);
  65. --#{$prefix}btn-border-radius: #{$border-radius};
  66. }
  67. // scss-docs-end btn-size-mixin