index.less 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. .popover-customize-bg(@notification-prefix-cls, @popover-background);
  4. @notification-prefix-cls: ~'@{ant-prefix}-notification';
  5. @notification-width: 384px;
  6. @notification-padding: @notification-padding-vertical @notification-padding-horizontal;
  7. @notification-margin-bottom: 16px;
  8. @notification-margin-edge: 24px;
  9. .@{notification-prefix-cls} {
  10. .reset-component();
  11. position: fixed;
  12. z-index: @zindex-notification;
  13. margin-right: @notification-margin-edge;
  14. &-close-icon {
  15. font-size: @font-size-base;
  16. cursor: pointer;
  17. }
  18. &-hook-holder {
  19. position: relative;
  20. }
  21. &-notice {
  22. position: relative;
  23. width: @notification-width;
  24. max-width: ~'calc(100vw - @{notification-margin-edge} * 2)';
  25. margin-bottom: @notification-margin-bottom;
  26. margin-left: auto;
  27. padding: @notification-padding;
  28. overflow: hidden;
  29. line-height: @line-height-base;
  30. word-wrap: break-word;
  31. background: @notification-bg;
  32. border-radius: @border-radius-base;
  33. box-shadow: @shadow-2;
  34. .@{notification-prefix-cls}-top &,
  35. .@{notification-prefix-cls}-bottom & {
  36. margin-right: auto;
  37. margin-left: auto;
  38. }
  39. .@{notification-prefix-cls}-topLeft &,
  40. .@{notification-prefix-cls}-bottomLeft & {
  41. margin-right: auto;
  42. margin-left: 0;
  43. }
  44. &-message {
  45. margin-bottom: 8px;
  46. color: @heading-color;
  47. font-size: @font-size-lg;
  48. line-height: 24px;
  49. // https://github.com/ant-design/ant-design/issues/5846#issuecomment-296244140
  50. &-single-line-auto-margin {
  51. display: block;
  52. width: ~'calc(@{notification-width} - @{notification-padding-horizontal} * 2 - 24px - 48px - 100%)';
  53. max-width: 4px;
  54. background-color: transparent;
  55. pointer-events: none;
  56. &::before {
  57. display: block;
  58. content: '';
  59. }
  60. }
  61. }
  62. &-description {
  63. font-size: @font-size-base;
  64. }
  65. &-closable &-message {
  66. padding-right: 24px;
  67. }
  68. &-with-icon &-message {
  69. margin-bottom: 4px;
  70. margin-left: 48px;
  71. font-size: @font-size-lg;
  72. }
  73. &-with-icon &-description {
  74. margin-left: 48px;
  75. font-size: @font-size-base;
  76. }
  77. // Icon & color style in different selector level
  78. // https://github.com/ant-design/ant-design/issues/16503
  79. // https://github.com/ant-design/ant-design/issues/15512
  80. &-icon {
  81. position: absolute;
  82. margin-left: 4px;
  83. font-size: 24px;
  84. line-height: 24px;
  85. }
  86. .@{iconfont-css-prefix}&-icon {
  87. &-success {
  88. color: @success-color;
  89. }
  90. &-info {
  91. color: @info-color;
  92. }
  93. &-warning {
  94. color: @warning-color;
  95. }
  96. &-error {
  97. color: @error-color;
  98. }
  99. }
  100. &-close {
  101. position: absolute;
  102. top: 16px;
  103. right: 22px;
  104. color: @text-color-secondary;
  105. outline: none;
  106. &:hover {
  107. & when (@theme = dark) {
  108. color: fade(@white, 85%);
  109. }
  110. & when not (@theme = dark) {
  111. color: shade(@text-color-secondary, 40%);
  112. }
  113. }
  114. }
  115. &-btn {
  116. float: right;
  117. margin-top: 16px;
  118. }
  119. }
  120. .notification-fade-effect {
  121. animation-duration: 0.24s;
  122. animation-timing-function: @ease-in-out;
  123. animation-fill-mode: both;
  124. }
  125. &-fade-enter,
  126. &-fade-appear {
  127. .notification-fade-effect();
  128. opacity: 0;
  129. animation-play-state: paused;
  130. }
  131. &-fade-leave {
  132. .notification-fade-effect();
  133. animation-duration: 0.2s;
  134. animation-play-state: paused;
  135. }
  136. &-fade-enter&-fade-enter-active,
  137. &-fade-appear&-fade-appear-active {
  138. animation-name: NotificationFadeIn;
  139. animation-play-state: running;
  140. }
  141. &-fade-leave&-fade-leave-active {
  142. animation-name: NotificationFadeOut;
  143. animation-play-state: running;
  144. }
  145. }
  146. @keyframes NotificationFadeIn {
  147. 0% {
  148. left: @notification-width;
  149. opacity: 0;
  150. }
  151. 100% {
  152. left: 0;
  153. opacity: 1;
  154. }
  155. }
  156. @keyframes NotificationFadeOut {
  157. 0% {
  158. max-height: 150px;
  159. margin-bottom: @notification-margin-bottom;
  160. opacity: 1;
  161. }
  162. 100% {
  163. max-height: 0;
  164. margin-bottom: 0;
  165. padding-top: 0;
  166. padding-bottom: 0;
  167. opacity: 0;
  168. }
  169. }
  170. @import './rtl';
  171. @import './placement';