Newer
Older
vmk-ui-kit / src / scss / components / _loader.scss
/* =========================
   Loader / Spinner
   Figma: Vertical Indicators.
========================= */

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

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loader-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: $neutral-900;
  overflow: hidden;

  &.loader-sm {
    font-size: 16px;
  }

  &.loader-md {
    font-size: 24px;
  }

  &.loader-lg {
    font-size: 40px;
  }
}

.loader-spin {
  width: 1em;
  height: 1em;
  border: 0.15em solid currentColor;
  border-right-color: transparent;
  border-radius: $radius-full;
  animation: loader-spin 0.8s linear infinite;
}

.loader-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;

  span {
    width: 0.25em;
    height: 0.25em;
    border-radius: $radius-full;
    background: currentColor;
    animation: loader-pulse 1.2s ease-in-out infinite;

    &:nth-child(2) {
      animation-delay: 0.2s;
    }

    &:nth-child(3) {
      animation-delay: 0.4s;
    }
  }
}

.loader-bar {
  width: 1em;
  min-width: 40px;
  height: 0.18em;
  min-height: 4px;
  border-radius: $radius-full;
  background: $neutral-200;
  overflow: hidden;

  &::after {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    border-radius: $radius-full;
    background: currentColor;
    animation: loader-bar 1.2s ease-in-out infinite;
  }
}

@keyframes loader-bar {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(250%);
  }
}

.loader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba($neutral-0, 0.72);
  z-index: 10;
}

.loader-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: $space-3;
  color: $neutral-700;
  font-family: $font-family-base;
  font-size: 14px;
}