badge.scss 1.3 KB

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