badge.scss 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @include b(badge) {
  5. @include set-component-css-var('badge', $badge);
  6. position: relative;
  7. vertical-align: middle;
  8. display: inline-block;
  9. width: fit-content;
  10. @include e(content) {
  11. background-color: getCssVar('badge', 'bg-color');
  12. border-radius: getCssVar('badge', 'radius');
  13. color: getCssVar('color', 'white');
  14. display: inline-flex;
  15. justify-content: center;
  16. align-items: center;
  17. font-size: getCssVar('badge', 'font-size');
  18. height: getCssVar('badge', 'size');
  19. padding: 0 getCssVar('badge', 'padding');
  20. white-space: nowrap;
  21. border: 1px solid getCssVar('bg-color');
  22. @include when(fixed) {
  23. position: absolute;
  24. top: 0;
  25. right: calc(1px + #{getCssVar('badge', 'size')} / 2);
  26. transform: translateY(-50%) translateX(100%);
  27. z-index: getCssVar('index', 'normal');
  28. @include when(dot) {
  29. right: 5px;
  30. }
  31. }
  32. @include when(dot) {
  33. height: 8px;
  34. width: 8px;
  35. padding: 0;
  36. right: 0;
  37. border-radius: 50%;
  38. }
  39. @each $type in (primary, success, warning, info, danger) {
  40. @include m($type) {
  41. background-color: getCssVar('color', $type);
  42. }
  43. }
  44. }
  45. }