_avatars.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .avatar {
  2. --#{$prefix}avatar-size: #{$avatar-size};
  3. --#{$prefix}avatar-status-size: #{$avatar-status-size};
  4. --#{$prefix}avatar-bg: #{$avatar-bg};
  5. --#{$prefix}avatar-box-shadow: #{$avatar-box-shadow};
  6. --#{$prefix}avatar-font-size: #{$avatar-font-size};
  7. --#{$prefix}avatar-icon-size: #{$avatar-icon-size};
  8. position: relative;
  9. width: var(--#{$prefix}avatar-size);
  10. height: var(--#{$prefix}avatar-size);
  11. font-size: var(--#{$prefix}avatar-font-size);
  12. font-weight: var(--#{$prefix}font-weight-medium);
  13. line-height: 1;
  14. display: inline-flex;
  15. align-items: center;
  16. justify-content: center;
  17. color: var(--#{$prefix}secondary);
  18. text-align: center;
  19. text-transform: uppercase;
  20. vertical-align: bottom;
  21. user-select: none;
  22. background: var(--#{$prefix}avatar-bg) no-repeat center/cover;
  23. border-radius: $avatar-border-radius;
  24. box-shadow: var(--#{$prefix}avatar-box-shadow);
  25. .icon {
  26. width: var(--#{$prefix}avatar-icon-size);
  27. height: var(--#{$prefix}avatar-icon-size);
  28. }
  29. .badge {
  30. position: absolute;
  31. right: 0;
  32. bottom: 0;
  33. border-radius: $border-radius-pill;
  34. box-shadow: 0 0 0 calc(var(--#{$prefix}avatar-status-size) / 4) $card-bg;
  35. }
  36. @at-root a#{&} {
  37. cursor: pointer;
  38. }
  39. }
  40. .avatar-rounded {
  41. border-radius: $border-radius-pill;
  42. }
  43. @each $avatar-size, $size in $avatar-sizes {
  44. .avatar-#{$avatar-size} {
  45. --#{$prefix}avatar-size: #{map-get($size, size)};
  46. --#{$prefix}avatar-status-size: #{map-get($size, status-size)};
  47. --#{$prefix}avatar-font-size: #{map-get($size, font-size)};
  48. --#{$prefix}avatar-icon-size: #{map-get($size, icon-size)};
  49. }
  50. .avatar-#{$avatar-size} .badge:empty {
  51. width: map-get($size, status-size);
  52. height: map-get($size, status-size);
  53. }
  54. }
  55. //
  56. // Avatar list
  57. //
  58. .avatar-list {
  59. @include elements-list;
  60. a.avatar {
  61. &:hover {
  62. z-index: 1;
  63. }
  64. }
  65. }
  66. .avatar-list-stacked {
  67. display: block;
  68. --#{$prefix}list-gap: 0;
  69. .avatar {
  70. margin-right: calc(#{$avatar-list-spacing} * var(--#{$prefix}avatar-size)) !important;
  71. box-shadow: var(--#{$prefix}avatar-box-shadow), 0 0 0 2px var(--#{$prefix}card-cap-bg, var(--#{$prefix}card-bg, var(--#{$prefix}bg-surface)));
  72. }
  73. }
  74. //
  75. // Avatar upload
  76. //
  77. .avatar-upload {
  78. width: 4rem;
  79. height: 4rem;
  80. border: var(--#{$prefix}border-width) dashed var(--#{$prefix}border-color);
  81. background: $form-check-input-bg;
  82. flex-direction: column;
  83. @include transition(color $transition-time, background-color $transition-time);
  84. svg {
  85. width: 1.5rem;
  86. height: 1.5rem;
  87. stroke-width: 1;
  88. }
  89. &:hover {
  90. border-color: var(--#{$prefix}primary);
  91. color: var(--#{$prefix}primary);
  92. text-decoration: none;
  93. }
  94. }
  95. .avatar-upload-text {
  96. font-size: $h6-font-size;
  97. line-height: 1;
  98. margin-top: .25rem;
  99. }
  100. .avatar-cover {
  101. margin-top: calc(-.5 * var(--#{$prefix}avatar-size));
  102. box-shadow: 0 0 0 .25rem var(--#{$prefix}card-bg, var(--#{$prefix}body-bg));
  103. }