aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/loaders/progress-bar/progress-bar.module.scss
blob: 3605ae7295e4ad13fd03ebf76dd9f89e2e203861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@use "../../../../styles/abstracts/functions" as fun;

.wrapper {
  width: fit-content;
  text-align: center;

  &--centered {
    margin-inline: auto;
  }
}

.label {
  margin-bottom: var(--spacing-2xs);
  font-size: var(--font-size-sm);
  cursor: default;
}

.progress {
  width: clamp(25ch, 20vw, 30ch);
  height: fun.convert-px(13);
  position: relative;
  overflow: hidden;
  background: var(--color-bg-tertiary);
  border: fun.convert-px(1) solid var(--color-primary-darker);
  border-radius: 1em;
  box-shadow: inset 0 0 fun.convert-px(4) fun.convert-px(1)
    var(--color-shadow-light);
  container-type: inline-size;

  &::before {
    content: "";
    position: absolute;
    width: 15%;
    left: 0;
  }

  &::before,
  &__bar {
    background-color: var(--color-primary-dark);
    border-radius: 1em;
  }

  &::before,
  progress {
    height: 100%;
    opacity: 0;
  }

  &__bar,
  progress {
    width: 100%;
    position: absolute;
    inset: 0;
  }

  &__bar {
    transform: translateX(var(--currentProgress));
    transition: all 0.25s linear 0s;
  }

  progress {
    appearance: none;
  }

  &--loading {
    &::before {
      opacity: 1;
      animation: move 1s linear 0s infinite alternate both;
    }
  }

  &--loading &__bar {
    opacity: 0;
  }
}

@keyframes move {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(calc(100cqw - 100%));
  }
}