message.scss 2.3 KB

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