toast.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. @import "./animation.scss";
  2. @import "./variables.scss";
  3. $module: #{$prefix}-toast;
  4. $icon: #{$prefix}-toast-icon;
  5. .#{$module} {
  6. pointer-events: none;
  7. &-wrapper {
  8. pointer-events: none;
  9. position: fixed;
  10. top: $spacing-toast_wrapper-top;
  11. width: $width-toast_wrapper;
  12. text-align: center;
  13. z-index: $z-toast;
  14. }
  15. &-content {
  16. pointer-events: all;
  17. @include shadow-elevated;
  18. @include font-size-regular;
  19. background-color: $color-toast-bg-default;
  20. border-radius: $radius-toast_content;
  21. padding: $spacing-toast_content-paddingTop $spacing-toast_content-paddingRight $spacing-toast_content-paddingBottom $spacing-toast_content-paddingLeft;
  22. display: inline-flex;
  23. align-items: flex-start;
  24. justify-content: center;
  25. margin: $spacing-toast_content-margin;
  26. font-weight: $font-toast_content-fontWeight;
  27. color: $color-toast-text-default;
  28. .#{$module}-close-button {
  29. margin-top: $spacing-toast_content_close_btn-marginTop;
  30. height: $width-icon-large;
  31. }
  32. .#{$module}-content-text {
  33. margin-left: $spacing-toast_content_text-marginLeft;
  34. margin-right: $spacing-toast_content_text-marginRight;
  35. text-align: left;
  36. // word-wrap is an alias of overflow-wrap, word-wrap can take effect on more browsers, in order to prevent future changes, use both
  37. word-wrap: break-word;
  38. overflow-wrap: break-word;
  39. }
  40. }
  41. &-light {
  42. &.#{$module}-warning {
  43. .#{$module}-content {
  44. background-color: $color-toast_warning_light-bg;
  45. border: $width-toast_light-border solid $color-toast_warning_light-border;
  46. }
  47. .#{$icon}-warning {
  48. color: $color-toast_warning_light-icon;
  49. }
  50. }
  51. &.#{$module}-success {
  52. .#{$module}-content {
  53. background-color: $color-toast_success_light-bg;
  54. border: $width-toast_light-border solid $color-toast_success_light-border;
  55. }
  56. .#{$icon}-success {
  57. color: $color-toast_success_light-icon;
  58. }
  59. }
  60. &.#{$module}-info {
  61. .#{$module}-content {
  62. background-color: $color-toast_info_light-bg;
  63. border: $width-toast_light-border solid $color-toast_info_light-border;
  64. }
  65. .#{$icon}-info {
  66. color: $color-toast_info_light-icon;
  67. }
  68. }
  69. &.#{$module}-error {
  70. .#{$module}-content {
  71. background-color: $color-toast_danger_light-bg;
  72. border: $width-toast_light-border solid $color-toast_danger_light-border;
  73. }
  74. .#{$icon}-error {
  75. color: $color-toast_danger_light-icon;
  76. }
  77. }
  78. }
  79. .#{$icon}-warning {
  80. color: $color-toast_warning-icon;
  81. }
  82. .#{$icon}-success {
  83. color: $color-toast_success-icon;
  84. }
  85. .#{$icon}-info {
  86. color: $color-toast_info-icon;
  87. }
  88. .#{$icon}-error {
  89. color: $color-toast_danger-icon;
  90. }
  91. &-animation-show{
  92. animation: $animation_duration-toast-show #{$module}-keyframe-toast-show $animation_function-toast-show $animation_delay-toast-show ;
  93. animation-fill-mode: forwards;
  94. }
  95. &-animation-hide{
  96. animation: $animation_duration-toast-hide #{$module}-keyframe-toast-hide $animation_function-toast-hide $animation_delay-toast-hide ;
  97. animation-fill-mode: forwards;
  98. }
  99. @keyframes #{$module}-keyframe-toast-show{
  100. 0%{
  101. opacity: $animation_opacity-toast-show;
  102. transform: translateY($animation_transform_translateY-toast-show);
  103. }
  104. 100%{
  105. opacity: 1;
  106. }
  107. }
  108. @keyframes #{$module}-keyframe-toast-hide{
  109. 0%{
  110. opacity: 1;
  111. }
  112. 100%{
  113. opacity: $animation_opacity-toast-hide;
  114. transform: translateY($animation_transform_translateY-toast-hide);
  115. }
  116. }
  117. }
  118. @import "./rtl.scss";