Newer
Older
vmk-ui-kit / src / scss / components / _avatar.scss
/* =========================
   Avatar
   Figma: Avatar.
========================= */

@use "../kit-deps" as *;

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: $radius-full;
  background-color: $mint-100;
  color: $mint-700;
  font-family: $font-family-base;
  font-size: 16px;
  font-weight: $font-weight-bold;
  line-height: 1;
  text-transform: uppercase;
  overflow: hidden;
  user-select: none;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .avatar-status {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid $neutral-0;
    background-color: $mint-600;
    transform: translate(15%, -15%);

    &.is-offline { background-color: $neutral-400; }
    &.is-busy     { background-color: $warning-text; }
    &.is-away     { background-color: $yellow-500; }
    &.is-danger   { background-color: $danger-text; }
  }

  // Sizes
  &.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;

    .avatar-status {
      width: 8px;
      height: 8px;
      border-width: 1px;
    }
  }

  &.avatar-md {
    width: 48px;
    height: 48px;
    font-size: 16px;
  }

  &.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 20px;
  }

  &.avatar-xl {
    width: 96px;
    height: 96px;
    font-size: 32px;
  }

  // Variants
  &.avatar-neutral {
    background-color: $neutral-100;
    color: $neutral-700;
  }

  &.avatar-mint {
    background-color: $mint-100;
    color: $mint-700;
  }

  &.avatar-yellow {
    background-color: $yellow-100;
    color: $yellow-800;
  }

  &.avatar-lavender {
    background-color: $lavender-100;
    color: $lavender-700;
  }
}