_button.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. @use '../mixins/var' as *;
  2. @use '../mixins/function' as *;
  3. @use '../common/var' as *;
  4. @mixin button-plain($type) {
  5. $button-color-types: (
  6. '': (
  7. 'text-color': (
  8. 'color',
  9. $type,
  10. ),
  11. 'bg-color': (
  12. 'color',
  13. $type,
  14. 'light-9',
  15. ),
  16. 'border-color': (
  17. 'color',
  18. $type,
  19. 'light-5',
  20. ),
  21. ),
  22. 'hover': (
  23. 'text-color': (
  24. 'color',
  25. 'white',
  26. ),
  27. 'bg-color': (
  28. 'color',
  29. $type,
  30. ),
  31. 'border-color': (
  32. 'color',
  33. $type,
  34. ),
  35. ),
  36. 'active': (
  37. 'text-color': (
  38. 'color',
  39. 'white',
  40. ),
  41. ),
  42. );
  43. @each $type, $typeMap in $button-color-types {
  44. @each $typeColor, $list in $typeMap {
  45. @include css-var-from-global(('button', $type, $typeColor), $list);
  46. }
  47. }
  48. &.is-disabled {
  49. &,
  50. &:hover,
  51. &:focus,
  52. &:active {
  53. color: getCssVar('color', $type, 'light-5');
  54. background-color: getCssVar('color', $type, 'light-9');
  55. border-color: getCssVar('color', $type, 'light-8');
  56. }
  57. }
  58. }
  59. @mixin button-variant($type) {
  60. $button-color-types: (
  61. '': (
  62. 'text-color': (
  63. 'color',
  64. 'white',
  65. ),
  66. 'bg-color': (
  67. 'color',
  68. $type,
  69. ),
  70. 'border-color': (
  71. 'color',
  72. $type,
  73. ),
  74. 'outline-color': (
  75. 'color',
  76. $type,
  77. 'light-5',
  78. ),
  79. 'active-color': (
  80. 'color',
  81. $type,
  82. 'dark-2',
  83. ),
  84. ),
  85. 'hover': (
  86. 'text-color': (
  87. 'color',
  88. 'white',
  89. ),
  90. 'link-text-color': (
  91. 'color',
  92. $type,
  93. 'light-5',
  94. ),
  95. 'bg-color': (
  96. 'color',
  97. $type,
  98. 'light-3',
  99. ),
  100. 'border-color': (
  101. 'color',
  102. $type,
  103. 'light-3',
  104. ),
  105. ),
  106. 'active': (
  107. 'bg-color': (
  108. 'color',
  109. $type,
  110. 'dark-2',
  111. ),
  112. 'border-color': (
  113. 'color',
  114. $type,
  115. 'dark-2',
  116. ),
  117. ),
  118. 'disabled': (
  119. 'text-color': (
  120. 'color',
  121. 'white',
  122. ),
  123. 'bg-color': (
  124. 'color',
  125. $type,
  126. 'light-5',
  127. ),
  128. 'border-color': (
  129. 'color',
  130. $type,
  131. 'light-5',
  132. ),
  133. ),
  134. );
  135. @each $type, $typeMap in $button-color-types {
  136. @each $typeColor, $list in $typeMap {
  137. @include css-var-from-global(('button', $type, $typeColor), $list);
  138. }
  139. }
  140. &.is-plain,
  141. &.is-text,
  142. &.is-link {
  143. @include button-plain($type);
  144. }
  145. }
  146. @mixin button-size(
  147. $padding-vertical,
  148. $padding-horizontal,
  149. $font-size,
  150. $border-radius
  151. ) {
  152. padding: $padding-vertical $padding-horizontal;
  153. font-size: $font-size;
  154. border-radius: $border-radius;
  155. &.is-round {
  156. padding: $padding-vertical $padding-horizontal;
  157. }
  158. }