alert.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @include b(alert) {
  5. @include set-component-css-var('alert', $alert);
  6. width: 100%;
  7. padding: getCssVar('alert', 'padding');
  8. margin: 0;
  9. box-sizing: border-box;
  10. border-radius: getCssVar('alert', 'border-radius-base');
  11. position: relative;
  12. background-color: getCssVar('color', 'white');
  13. overflow: hidden;
  14. opacity: 1;
  15. display: flex;
  16. align-items: center;
  17. transition: opacity getCssVar('transition-duration', 'fast');
  18. @include when(light) {
  19. .#{$namespace}-alert__close-btn {
  20. color: getCssVar('text-color', 'placeholder');
  21. }
  22. }
  23. @include when(dark) {
  24. .#{$namespace}-alert__close-btn {
  25. color: getCssVar('color', 'white');
  26. }
  27. .#{$namespace}-alert__description {
  28. color: getCssVar('color', 'white');
  29. }
  30. }
  31. @include when(center) {
  32. justify-content: center;
  33. }
  34. @each $type in (success, info, warning, error) {
  35. @include m($type) {
  36. @include css-var-from-global(
  37. ('alert', 'bg-color'),
  38. ('color', $type, 'light-9')
  39. );
  40. &.is-light {
  41. background-color: getCssVar('alert', 'bg-color');
  42. color: getCssVar('color', $type);
  43. .#{$namespace}-alert__description {
  44. color: getCssVar('color', $type);
  45. }
  46. }
  47. &.is-dark {
  48. background-color: getCssVar('color', $type);
  49. color: getCssVar('color', 'white');
  50. }
  51. }
  52. }
  53. @include e(content) {
  54. display: flex;
  55. flex-direction: column;
  56. gap: 4px;
  57. }
  58. & .#{$namespace}-alert__icon {
  59. font-size: getCssVar('alert', 'icon-size');
  60. width: getCssVar('alert', 'icon-size');
  61. margin-right: 8px;
  62. @include when(big) {
  63. font-size: getCssVar('alert', 'icon-large-size');
  64. width: getCssVar('alert', 'icon-large-size');
  65. margin-right: 12px;
  66. }
  67. }
  68. @include e(title) {
  69. font-size: getCssVar('alert', 'title-font-size');
  70. line-height: 24px;
  71. &.with-description {
  72. font-size: getCssVar('alert', 'title-with-description-font-size');
  73. }
  74. }
  75. & .#{$namespace}-alert__description {
  76. font-size: getCssVar('alert', 'description-font-size');
  77. margin: 0;
  78. }
  79. & .#{$namespace}-alert__close-btn {
  80. font-size: getCssVar('alert', 'close-font-size');
  81. opacity: 1;
  82. position: absolute;
  83. top: 12px;
  84. right: 16px;
  85. cursor: pointer;
  86. @include when(customed) {
  87. font-style: normal;
  88. font-size: getCssVar('alert', 'close-customed-font-size');
  89. line-height: 24px;
  90. top: 8px;
  91. }
  92. }
  93. }
  94. .#{$namespace}-alert-fade-enter-from,
  95. .#{$namespace}-alert-fade-leave-active {
  96. opacity: 0;
  97. }