message.scss 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. left: 50%;
  17. top: 20px;
  18. transform: translateX(-50%);
  19. background-color: getCssVar('message', 'bg-color');
  20. transition: opacity getCssVar('transition-duration'), transform 0.4s, top 0.4s;
  21. padding: getCssVar('message', 'padding');
  22. display: flex;
  23. align-items: center;
  24. gap: 8px;
  25. @include when(plain) {
  26. background-color: getCssVar('bg-color', 'overlay');
  27. border-color: getCssVar('bg-color', 'overlay');
  28. box-shadow: getCssVar('box-shadow-light');
  29. }
  30. p {
  31. margin: 0;
  32. }
  33. @each $type in (success, info, warning, error) {
  34. @include m($type) {
  35. @include css-var-from-global(
  36. ('message', 'bg-color'),
  37. ('color', $type, 'light-9')
  38. );
  39. @include css-var-from-global(
  40. ('message', 'border-color'),
  41. ('color', $type, 'light-8')
  42. );
  43. @include css-var-from-global(('message', 'text-color'), ('color', $type));
  44. .#{$namespace}-message__content {
  45. color: getCssVar('message', 'text-color');
  46. overflow-wrap: break-word;
  47. }
  48. }
  49. & .#{$namespace}-message-icon--#{$type} {
  50. color: getCssVar('message', 'text-color');
  51. }
  52. }
  53. .#{$namespace}-message__badge {
  54. position: absolute;
  55. top: -8px;
  56. right: -8px;
  57. }
  58. @include e(content) {
  59. padding: 0;
  60. font-size: 14px;
  61. line-height: 1;
  62. &:focus {
  63. outline-width: 0;
  64. }
  65. }
  66. & .#{$namespace}-message__closeBtn {
  67. cursor: pointer;
  68. color: getCssVar('message', 'close-icon-color');
  69. font-size: getCssVar('message', 'close-size');
  70. &:focus {
  71. outline-width: 0;
  72. }
  73. &:hover {
  74. color: getCssVar('message', 'close-hover-color');
  75. }
  76. }
  77. }
  78. .#{$namespace}-message-fade-enter-from,
  79. .#{$namespace}-message-fade-leave-to {
  80. opacity: 0;
  81. transform: translate(-50%, -100%);
  82. }