index-pure.less 4.5 KB

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