_card.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. @use 'sass:color';
  2. @use 'tokens' as t;
  3. @mixin surface-card($padding: 20px, $radius: t.$radius-card) {
  4. background: t.$color-surface;
  5. border: 1px solid t.$color-border-soft;
  6. border-radius: $radius;
  7. box-shadow: t.$shadow-card-flat;
  8. padding: $padding;
  9. color: t.$color-text;
  10. }
  11. @mixin section-card($padding: 20px) {
  12. background: t.$color-surface;
  13. border: 1px solid t.$color-border-soft;
  14. border-radius: t.$radius-card;
  15. box-shadow: t.$shadow-card-flat;
  16. padding: $padding;
  17. }
  18. // content-card 基础壳体(白底卡片 + 标题区 + 主体)
  19. @mixin content-card($padding: 20px, $gap: 16px) {
  20. @include section-card($padding);
  21. display: flex;
  22. flex-direction: column;
  23. gap: $gap;
  24. min-width: 0;
  25. }
  26. // alert-card 壳体(左边色条 + 图标 + 主体 + 操作区)
  27. @mixin alert-card($accent: t.$color-blue, $padding: 16px 18px) {
  28. display: flex;
  29. align-items: flex-start;
  30. gap: 14px;
  31. min-width: 0;
  32. padding: $padding;
  33. border: 1px solid t.$color-border-soft;
  34. border-left: 4px solid $accent;
  35. border-radius: t.$radius-card;
  36. background: linear-gradient(135deg, rgba($accent, 0.08), t.$color-surface 46%);
  37. box-shadow: t.$shadow-card-flat;
  38. }
  39. // entry-card 壳体(可点击入口卡片)
  40. @mixin entry-card($padding: 18px 20px, $gap: 12px) {
  41. display: flex;
  42. flex-direction: column;
  43. gap: $gap;
  44. padding: $padding;
  45. background: t.$color-surface;
  46. border: 1px solid t.$color-border-soft;
  47. border-radius: t.$radius-card;
  48. box-shadow: t.$shadow-card-flat;
  49. cursor: pointer;
  50. transition: transform t.$transition-fast, box-shadow t.$transition-fast, border-color t.$transition-fast, background t.$transition-fast;
  51. &:hover {
  52. transform: translateY(-1px);
  53. background: t.$color-accent;
  54. box-shadow: t.$shadow-elev-1;
  55. border-color: t.$color-border;
  56. }
  57. &:focus-visible {
  58. @include t.focus-ring;
  59. }
  60. }
  61. // chart-card 壳体(图表卡片容器)
  62. @mixin chart-card($padding: 16px, $min-height: 260px) {
  63. display: flex;
  64. flex-direction: column;
  65. gap: 12px;
  66. min-width: 0;
  67. min-height: $min-height;
  68. padding: $padding;
  69. background: t.$color-surface;
  70. border: 1px solid t.$color-border-soft;
  71. border-radius: t.$radius-card;
  72. box-shadow: t.$shadow-card-flat;
  73. }
  74. @mixin metric-card($tone: default) {
  75. $accent: t.tone-color($tone);
  76. background: t.$color-surface;
  77. border: 1px solid t.$color-border-soft;
  78. border-radius: t.$radius-card;
  79. box-shadow: t.$shadow-card-flat;
  80. position: relative;
  81. overflow: hidden;
  82. padding: 18px 20px;
  83. transition: transform t.$transition-fast, box-shadow t.$transition-fast, border-color t.$transition-fast;
  84. &::before {
  85. content: '';
  86. position: absolute;
  87. inset: 0 auto 0 0;
  88. width: 3px;
  89. background: linear-gradient(180deg, rgba($accent, 0.9), rgba($accent, 0.24));
  90. border-radius: t.$radius-card 0 0 t.$radius-card;
  91. }
  92. &:hover {
  93. transform: translateY(-1px);
  94. background: t.$color-accent;
  95. border-color: t.$color-border;
  96. box-shadow: t.$shadow-elev-1;
  97. }
  98. }
  99. @mixin card-title {
  100. margin: 0;
  101. color: t.$color-text;
  102. font-size: 16px;
  103. font-weight: 700;
  104. line-height: 1.35;
  105. }
  106. @mixin card-subtitle {
  107. margin: 0;
  108. color: t.$color-text-muted;
  109. font-size: 13px;
  110. line-height: 1.6;
  111. }