avatar.scss 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. @import './variables.scss';
  2. @import './mixin.scss';
  3. $module: #{$prefix}-avatar;
  4. $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'light-green', 'lime', 'orange', 'pink',
  5. 'purple', 'red', 'teal', 'violet', 'yellow';
  6. .#{$module} {
  7. position: relative;
  8. display: inline-flex;
  9. overflow: hidden;
  10. align-items: center;
  11. justify-content: center;
  12. white-space: nowrap;
  13. text-align: center;
  14. vertical-align: middle;
  15. &:focus-visible {
  16. outline: $width-avatar-outline solid $color-avatar-outline-focus;
  17. }
  18. &-focus {
  19. outline: $width-avatar-outline solid $color-avatar-outline-focus;
  20. }
  21. &-no-focus-visible {
  22. &:focus-visible {
  23. outline: none;
  24. }
  25. }
  26. .#{$module}-label {
  27. display: flex;
  28. align-items: center;
  29. @include font-size-regular;
  30. font-weight: 600;
  31. }
  32. &-content {
  33. user-select: none;
  34. }
  35. &-extra-extra-small {
  36. width: $width-avatar_extra_extra_small;
  37. height: $width-avatar_extra_extra_small;
  38. .#{$module}-content {
  39. transform-origin: center;
  40. transform: scale(0.8);
  41. }
  42. .#{$module}-label {
  43. font-size: $font-avatar_extra_extra_small-size;
  44. line-height: $font-avatar_extra_extra_small-lineHeight;
  45. }
  46. }
  47. &-extra-small {
  48. width: $width-avatar_extra_small;
  49. height: $width-avatar_extra_small;
  50. .#{$module}-content {
  51. transform-origin: center;
  52. transform: scale(0.8);
  53. }
  54. .#{$module}-label {
  55. font-size: $font-avatar_extra_small-size;
  56. line-height: $font-avatar_extra_small-lineHeight;
  57. }
  58. }
  59. &-small {
  60. width: $width-avatar_small;
  61. height: $width-avatar_small;
  62. .#{$module}-label {
  63. @include font-size-small;
  64. }
  65. }
  66. &-default {
  67. width: $width-avatar_default;
  68. height: $width-avatar_default;
  69. .#{$module}-label {
  70. @include font-size-header-5;
  71. }
  72. }
  73. &-medium {
  74. width: $width-avatar_medium;
  75. height: $width-avatar_medium;
  76. .#{$module}-label {
  77. @include font-size-header-4;
  78. }
  79. }
  80. &-large {
  81. width: $width-avatar_large;
  82. height: $width-avatar_large;
  83. .#{$module}-label {
  84. @include font-size-header-1;
  85. }
  86. }
  87. &-extra-large {
  88. width: $width-avatar_extra_large;
  89. height: $width-avatar_extra_large;
  90. .#{$module}-label {
  91. font-size: $font-avatar_extra_large-size;
  92. line-height: $font-avatar_extra_large-lineHeight;
  93. }
  94. }
  95. &-circle {
  96. border-radius: $radius-avatar;
  97. }
  98. &-image {
  99. background-color: transparent;
  100. }
  101. & > img {
  102. display: block;
  103. width: 100%;
  104. height: 100%;
  105. object-fit: cover;
  106. }
  107. &-hover {
  108. position: absolute;
  109. left: 0;
  110. top: 0;
  111. width: 100%;
  112. height: 100%;
  113. }
  114. &:hover {
  115. cursor: pointer;
  116. }
  117. }
  118. .#{$module}-group {
  119. display: inline-block;
  120. .#{$module} {
  121. box-sizing: border-box;
  122. &:first-child {
  123. margin-left: 0;
  124. }
  125. }
  126. .#{$module}-extra-large {
  127. border: $width-avatar_extra_large-border $color-avatar_default-border-default solid;
  128. margin-left: $spacing-avatar_extra_large-marginLeft;
  129. }
  130. .#{$module}-large {
  131. border: $width-avatar_large-border $color-avatar_default-border-default solid;
  132. margin-left: $spacing-avatar_large-marginLeft;
  133. }
  134. .#{$module}-medium {
  135. border: $width-avatar_medium-border $color-avatar_default-border-default solid;
  136. margin-left: $spacing-avatar_medium-marginLeft;
  137. }
  138. .#{$module}-default {
  139. border: $width-avatar_default-border $color-avatar_default-border-default solid;
  140. margin-left: $spacing-avatar_default-marginLeft;
  141. }
  142. .#{$module}-small {
  143. border: $width-avatar_small-border $color-avatar_default-border-default solid;
  144. margin-left: $spacing-avatar_small-marginLeft;
  145. }
  146. .#{$module}-extra-small {
  147. border: $width-avatar_extra_small-border $color-avatar_default-border-default solid;
  148. margin-left: $spacing-avatar_extra_small-marginLeft;
  149. }
  150. .#{$module}-extra-extra-small {
  151. border: $width-avatar_extra_extra_small-border $color-avatar_default-border-default solid;
  152. margin-left: $spacing-avatar_extra_extra_small-marginLeft;
  153. }
  154. @for $i from 0 through 20 {
  155. .#{$module}-item-start-#{$i} {
  156. z-index: $z-avatar-default - $i;
  157. }
  158. .#{$module}-item-end-#{$i} {
  159. z-index: $z-avatar-default - 20 + $i;
  160. }
  161. }
  162. .#{$module}-item-more {
  163. background-color: $color-avatar_more_default-bg-default;
  164. }
  165. }
  166. @each $c in $colors {
  167. .#{$module}-#{$c} {
  168. @include avatar-style($c);
  169. }
  170. }
  171. @import './rtl.scss';