style.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. @use "sass:color";
  2. // 按钮高光(无 hover/active 效果)
  3. @mixin highlight-glow($base-color) {
  4. $light-color: color.adjust($base-color, $lightness: 8%);
  5. $dark-color: color.adjust($base-color, $lightness: -10%);
  6. background: linear-gradient(135deg, $light-color 0%, $dark-color 100%);
  7. box-shadow:
  8. inset 0 1px 2px rgba(255, 255, 255, 0.3),
  9. inset 0 -1px 2px rgba(0, 0, 0, 0.3),
  10. 0 2px 4px rgba(0, 0, 0, 0.2);
  11. position: relative;
  12. overflow: hidden;
  13. &::before {
  14. content: '';
  15. position: absolute;
  16. top: 0;
  17. left: 0;
  18. right: 0;
  19. height: 50%;
  20. background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  21. pointer-events: none;
  22. }
  23. }
  24. // 按钮高亮(含 hover/active)
  25. @mixin highlight-btn($base-color) {
  26. $light-color: color.adjust($base-color, $lightness: 8%);
  27. $dark-color: color.adjust($base-color, $lightness: -10%);
  28. $hover-light: color.adjust($base-color, $lightness: 12%);
  29. $hover-dark: color.adjust($base-color, $lightness: 2%);
  30. $active-dark: color.adjust($base-color, $lightness: -15%);
  31. $active-darker: color.adjust($base-color, $lightness: -20%);
  32. background: linear-gradient(135deg, $light-color 0%, $dark-color 100%);
  33. box-shadow:
  34. inset 0 1px 2px rgba(255, 255, 255, 0.3),
  35. inset 0 -1px 2px rgba(0, 0, 0, 0.3),
  36. 0 2px 4px rgba(0, 0, 0, 0.2);
  37. position: relative;
  38. overflow: hidden;
  39. cursor: pointer;
  40. transition: all 0.2s ease;
  41. &::before {
  42. content: '';
  43. position: absolute;
  44. top: 0;
  45. left: 0;
  46. right: 0;
  47. height: 50%;
  48. background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  49. pointer-events: none;
  50. }
  51. &:hover {
  52. background: linear-gradient(135deg, $hover-light 0%, $hover-dark 100%);
  53. box-shadow:
  54. inset 0 1px 2px rgba(255, 255, 255, 0.4),
  55. inset 0 -1px 2px rgba(0, 0, 0, 0.3),
  56. 0 3px 6px rgba(0, 0, 0, 0.3);
  57. }
  58. &:active {
  59. background: linear-gradient(135deg, $active-dark 0%, $active-darker 100%);
  60. box-shadow:
  61. inset 0 2px 4px rgba(0, 0, 0, 0.4),
  62. 0 1px 2px rgba(0, 0, 0, 0.2);
  63. }
  64. }
  65. // ========== Mixin 配置 ==========
  66. @mixin flex-center {
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. }
  71. @mixin flex-row-between {
  72. display: flex;
  73. flex-direction: row;
  74. align-items: center;
  75. justify-content: space-between;
  76. }
  77. @mixin flex-column-start {
  78. display: flex;
  79. flex-direction: column;
  80. align-items: center;
  81. justify-content: flex-start;
  82. }
  83. @mixin flex-column-between {
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: space-between;
  88. }
  89. @mixin box-sizing-border-box {
  90. box-sizing: border-box;
  91. overflow: hidden;
  92. margin: 0;
  93. padding: 0;
  94. }
  95. @mixin div-btn-hover-effect {
  96. transition: transform 0.2s ease;
  97. &:hover {
  98. transform: scale(1.05);
  99. }
  100. }
  101. @mixin div-btn-pressed-effect {
  102. transition: transform 0.1s ease;
  103. &:active {
  104. transform: scale(0.95);
  105. }
  106. }