floatButton.scss 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. @import './variables.scss';
  2. $module: #{$prefix}-floatButton;
  3. $moduleGroup: #{$prefix}-floatButtonGroup;
  4. .#{$module} {
  5. position: fixed;
  6. bottom: $spacing-floatButton-bottom;
  7. right: $spacing-floatButton-right;
  8. z-index: $z-floatButton;
  9. cursor: pointer;
  10. &-body {
  11. background-color: $color-floatButton-bg;
  12. box-shadow: $shadow-floatButton;
  13. color: $color-floatButton-text;
  14. display: flex;
  15. align-items: center;
  16. justify-content: center;
  17. &:hover {
  18. background-color: $color-floatButton-bg-hover;
  19. }
  20. &:active {
  21. background-color: $color-floatButton-bg-active;
  22. }
  23. }
  24. &-disabled {
  25. background: $color-floatButton-disabled-bg;
  26. color: $color-floatButton-disabled-text;
  27. cursor: not-allowed;
  28. &:hover {
  29. background-color: $color-floatButton-disabled-bg;
  30. }
  31. }
  32. &-colorful {
  33. background: $color-floatButton-colorful-bg;
  34. color: $color-floatButton-colorful-text;
  35. &:hover {
  36. background: $color-floatButton-colorful-bg-hover;
  37. }
  38. &:active {
  39. background: $color-floatButton-colorful-bg-active;
  40. }
  41. }
  42. &.#{$module}-square {
  43. .#{$prefix}-badge-dot, .#{$prefix}-badge-count {
  44. /* Calculation logic:
  45. The center of the badge is the intersection of two lines.
  46. - The first line is the connecting line between the center of the floatButton and the upper right corner of the enclosing rectangle.
  47. - The second line is the border of the floatButton.
  48. Can be calculated through radius, (√2 - 1)/√2 * R = 0.29 * R
  49. */
  50. top: calc(0.29 * $radius-floatButton_square);
  51. inset-inline-end: calc(0.29 * $radius-floatButton_square);
  52. }
  53. }
  54. &-default {
  55. width: $width-floatButton;
  56. height: $width-floatButton;
  57. &.#{$module}-round {
  58. .#{$prefix}-badge-dot, .#{$prefix}-badge-count {
  59. /* Calculation logic:
  60. The center of the badge is the intersection of two lines.
  61. - The first line is the connecting line between the center of the floatButton and the upper right corner of the enclosing rectangle.
  62. - The second line is the border of the floatButton.
  63. Can be calculated through radius (√2 - 1)/√2 * R = 0.29 * R,and R = 0.5 * width
  64. */
  65. top: calc(0.29 * 0.5 * $width-floatButton);
  66. inset-inline-end: calc(0.29 * 0.5 * $width-floatButton);
  67. }
  68. }
  69. }
  70. &-small {
  71. width: $width-floatButton_small;
  72. height: $width-floatButton_small;
  73. &.#{$module}-round {
  74. .#{$prefix}-badge-dot, .#{$prefix}-badge-count {
  75. top: calc(0.29 * 0.5 * $width-floatButton_small);
  76. inset-inline-end: calc(0.29 * 0.5 *$width-floatButton_small);
  77. }
  78. }
  79. }
  80. &-large {
  81. width: $width-floatButton_large;
  82. height: $width-floatButton_large;
  83. &.#{$module}-round {
  84. .#{$prefix}-badge-dot, .#{$prefix}-badge-count {
  85. top: calc(0.29 * 0.5 * $width-floatButton_large);
  86. inset-inline-end: calc(0.29 * 0.5 * $width-floatButton_large);
  87. }
  88. }
  89. }
  90. &-square {
  91. border-radius: $radius-floatButton_square;
  92. }
  93. &-round {
  94. border-radius: $radius-floatButton_round;
  95. }
  96. }
  97. .#{$moduleGroup} {
  98. position: fixed;
  99. border-radius: $radius-floatButton_group-border-radius;
  100. bottom: $spacing-floatButton_group-bottom;
  101. right: $spacing-floatButton_group-right;
  102. z-index: $z-floatButton_group;
  103. background: $color-floatButton_group-bg;
  104. box-shadow: $shadow-floatButton_group;
  105. display: inline-flex;
  106. padding: $spacing-floatButton_group-padding;
  107. gap: $spacing-floatButton_group-columnGap;
  108. &-item {
  109. cursor: pointer;
  110. display: flex;
  111. padding: $spacing-floatButton_group_item-paddingY $spacing-floatButton_group_item-paddingX;
  112. align-items: center;
  113. column-gap: $spacing-floatButton_group_item-columnGap;
  114. border-radius: $radius-floatButton_group_item-border-radius;
  115. color: $color-floatButton_group_item-text;
  116. font-size: $font-floatButton_group_item-fontSize;
  117. font-style: normal;
  118. font-weight: $font-floatButton_group_item-fontWeight;
  119. line-height: $font-floatButton_group_item-lineHeight;
  120. &:hover {
  121. background: $color-floatButton_group_item-bg-hover;
  122. }
  123. &:active {
  124. background: $color-floatButton_group_item-bg-active;
  125. }
  126. }
  127. }
  128. @import "./rtl.scss";