d6f226738d873f76d344bb83e65eb1ce511afd427f37bfc66925098bf2cdcefeba07f46ef2f87e4aa96654136f9f52b3f57957450fb6238cd85fa5cba1db37 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @include b(message) {
  5. @include set-component-css-var('message', $message);
  6. }
  7. @include b(message) {
  8. width: fit-content;
  9. max-width: calc(100% - 32px);
  10. box-sizing: border-box;
  11. border-radius: getCssVar('border-radius-base');
  12. border-width: getCssVar('border-width');
  13. border-style: getCssVar('border-style');
  14. border-color: getCssVar('message', 'border-color');
  15. position: fixed;
  16. background-color: getCssVar('message', 'bg-color');
  17. transition: opacity getCssVar('transition-duration'), transform 0.4s, top 0.4s,
  18. bottom 0.4s;
  19. padding: getCssVar('message', 'padding');
  20. display: flex;
  21. align-items: center;
  22. gap: 8px;
  23. &.is-left {
  24. left: 16px;
  25. }
  26. &.is-right {
  27. right: 16px;
  28. }
  29. &.is-center {
  30. left: 50%;
  31. transform: translateX(-50%);
  32. }
  33. @include when(plain) {
  34. background-color: getCssVar('bg-color', 'overlay');
  35. border-color: getCssVar('bg-color', 'overlay');
  36. box-shadow: getCssVar('box-shadow-light');
  37. }
  38. p {
  39. margin: 0;
  40. }
  41. @each $type in (primary, success, info, warning, error) {
  42. @include m($type) {
  43. @include css-var-from-global(
  44. ('message', 'bg-color'),
  45. ('color', $type, 'light-9')
  46. );
  47. @include css-var-from-global(
  48. ('message', 'border-color'),
  49. ('color', $type, 'light-8')
  50. );
  51. @include css-var-from-global(('message', 'text-color'), ('color', $type));
  52. .#{$namespace}-message__content {
  53. color: getCssVar('message', 'text-color');
  54. overflow-wrap: break-word;
  55. }
  56. }
  57. & .#{$namespace}-message-icon--#{$type} {
  58. color: getCssVar('message', 'text-color');
  59. }
  60. }
  61. .#{$namespace}-message__badge {
  62. position: absolute;
  63. top: -8px;
  64. right: -8px;
  65. }
  66. @include e(content) {
  67. padding: 0;
  68. font-size: 14px;
  69. line-height: 1;
  70. &:focus {
  71. outline-width: 0;
  72. }
  73. }
  74. & .#{$namespace}-message__closeBtn {
  75. cursor: pointer;
  76. color: getCssVar('message', 'close-icon-color');
  77. font-size: getCssVar('message', 'close-size');
  78. &:focus {
  79. outline-width: 0;
  80. }
  81. &:hover {
  82. color: getCssVar('message', 'close-hover-color');
  83. }
  84. }
  85. }
  86. .#{$namespace}-message-fade-enter-from,
  87. .#{$namespace}-message-fade-leave-to {
  88. opacity: 0;
  89. &:is(.is-left, .is-right) {
  90. transform: translateY(-100%);
  91. &.is-bottom {
  92. transform: translateY(100%);
  93. }
  94. }
  95. &.is-center {
  96. transform: translate(-50%, -100%);
  97. &.is-bottom {
  98. transform: translate(-50%, 100%);
  99. }
  100. }
  101. }