avatar.scss 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. @use 'sass:map';
  2. @use "sass:list";
  3. $avatarThemeList: (
  4. (
  5. name: "primary",
  6. textColor: var(--vxe-ui-font-primary-color),
  7. btnColor: #fff,
  8. ),
  9. (
  10. name: "success",
  11. textColor: var(--vxe-ui-status-success-color),
  12. btnColor: #fff,
  13. ),
  14. (
  15. name: "info",
  16. textColor: var(--vxe-ui-status-info-color),
  17. btnColor: #fff,
  18. ),
  19. (
  20. name: "warning",
  21. textColor: var(--vxe-ui-status-warning-color),
  22. btnColor: #fff,
  23. ),
  24. (
  25. name: "danger",
  26. textColor: var(--vxe-ui-status-danger-color),
  27. btnColor: #fff,
  28. ),
  29. (
  30. name: "error",
  31. textColor: var(--vxe-ui-status-error-color),
  32. btnColor: #fff,
  33. )
  34. );
  35. .vxe-avatar {
  36. position: relative;
  37. display: inline-flex;
  38. flex-direction: row;
  39. align-items: center;
  40. justify-content: center;
  41. border-radius: var(--vxe-ui-base-border-radius);
  42. vertical-align: middle;
  43. &.is--circle {
  44. border-radius: 50%;
  45. .vxe-avatar--img {
  46. border-radius: 50%;
  47. }
  48. }
  49. &.is--dot {
  50. &::before {
  51. content: "";
  52. position: absolute;
  53. top: -0.25em;
  54. right: -0.25em;
  55. text-align: center;
  56. width: 0.5em;
  57. height: 0.5em;
  58. border-radius: 50%;
  59. background-color: #ff4d4f;
  60. z-index: 1;
  61. }
  62. }
  63. @for $index from 0 to list.length($avatarThemeList) {
  64. $item: list.nth($avatarThemeList, $index + 1);
  65. $textColor: map.get($item, textColor);
  66. $btnColor: map.get($item, btnColor);
  67. &.theme--#{map.get($item, name)} {
  68. color: $btnColor;
  69. border-color: $textColor;
  70. background-color: $textColor;
  71. }
  72. }
  73. }
  74. .vxe-avatar--img {
  75. width: 100%;
  76. height: 100%;
  77. border-radius: var(--vxe-ui-base-border-radius);
  78. }
  79. .vxe-avatar--count {
  80. position: absolute;
  81. top: -0.8em;
  82. right: -0.8em;
  83. text-align: center;
  84. min-width: 1.5em;
  85. height: 1.5em;
  86. padding: 0 0.4em;
  87. border-radius: 0.8em;
  88. font-size: 0.8em;
  89. background-color: #ff4d4f;
  90. color: #fff;
  91. z-index: 1;
  92. }
  93. .vxe-avatar {
  94. width: 36px;
  95. height: 36px;
  96. &.size--medium {
  97. width: 32px;
  98. height: 32px;
  99. font-size: var(--vxe-ui-font-size-medium);
  100. }
  101. &.size--small {
  102. width: 28px;
  103. height: 28px;
  104. font-size: var(--vxe-ui-font-size-small);
  105. }
  106. &.size--mini {
  107. width: 24px;
  108. height: 24px;
  109. font-size: var(--vxe-ui-font-size-mini);
  110. }
  111. }