index.less 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. @import "../styles/mixins/index.less";
  2. @import "../styles/themes/index.less";
  3. .@{wux-prefix}-badge {
  4. position: relative;
  5. display: inline-block;
  6. line-height: 1;
  7. vertical-align: middle;
  8. &__count {
  9. position: absolute;
  10. transform: translate(50%, -50%);
  11. top: 0;
  12. right: 0;
  13. height: @badge-height;
  14. border-radius: @badge-height / 2;
  15. min-width: @badge-height;
  16. background: @badge-bg;
  17. // border: 1px solid transparent;
  18. color: @badge-color;
  19. line-height: @badge-height;
  20. text-align: center;
  21. padding: 0 5px;
  22. font-size: @badge-font-size;
  23. white-space: nowrap;
  24. transform-origin: 100% 0%;
  25. z-index: 10;
  26. box-shadow: 0 0 0 1px @shadow-color-inverse;
  27. box-sizing: border-box;
  28. text-rendering: optimizeLegibility;
  29. }
  30. &__dot {
  31. .square(@badge-dot-size);
  32. position: absolute;
  33. transform: translate(50%, -50%);
  34. transform-origin: 100% 0%;
  35. top: 0;
  36. right: 0;
  37. border-radius: 100%;
  38. background: @badge-bg;
  39. z-index: 10;
  40. box-shadow: 0 0 0 1px @shadow-color-inverse;
  41. }
  42. &--position-topLeft &__count,
  43. &--position-topLeft &__dot {
  44. right: 100%;
  45. }
  46. &--position-bottomRight &__count,
  47. &--position-bottomRight &__dot {
  48. top: 100%;
  49. }
  50. &--position-bottomLeft &__count,
  51. &--position-bottomLeft &__dot {
  52. top: 100%;
  53. right: 100%;
  54. }
  55. &--hide-shadow &__count,
  56. &--hide-shadow &__dot {
  57. box-shadow: none !important;
  58. }
  59. &__status {
  60. line-height: inherit;
  61. vertical-align: baseline;
  62. }
  63. &__status-dot {
  64. .square(@badge-status-size);
  65. display: inline-block;
  66. border-radius: 50%;
  67. vertical-align: middle;
  68. position: relative;
  69. top: -1px;
  70. &--success {
  71. background-color: @badge-success-bg;
  72. }
  73. &--processing {
  74. background-color: @badge-processing-bg;
  75. position: relative;
  76. }
  77. &--processing::after {
  78. position: absolute;
  79. top: -1px;
  80. left: -1px;
  81. width: 100%;
  82. height: 100%;
  83. border-radius: 50%;
  84. border: 1px solid @badge-processing-bg;
  85. content: "";
  86. animation: statusProcessing 1.2s infinite ease-in-out;
  87. }
  88. &--default {
  89. background-color: @badge-normal-bg;
  90. }
  91. &--error {
  92. background-color: @badge-error-bg;
  93. }
  94. &--warning {
  95. background-color: @badge-warning-bg;
  96. }
  97. }
  98. &__status-text {
  99. display: inline-block;
  100. color: @text-color;
  101. font-size: @font-size-base;
  102. margin-left: 8px;
  103. }
  104. }
  105. @keyframes statusProcessing {
  106. 0% {
  107. transform: scale(.8);
  108. opacity: .5;
  109. }
  110. to {
  111. transform: scale(2.4);
  112. opacity: 0;
  113. }
  114. }