aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/flip/flip.module.scss
blob: 20b171543e249c6fb7a901fd68f0eef3b1b4c66a (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
@use "../../../styles/abstracts/functions" as fun;

.front,
.back {
  grid-area: 1 / 1 / 2 / 2;
  backface-visibility: hidden;
  transition: all var(--flipper-speed, 0.6s) linear 0s;
}

.back {
  transform: var(--rotation);
}

.wrapper {
  display: grid;
  transform-style: preserve-3d;

  &--dynamic {
    &:hover,
    &:focus,
    &:focus-within {
      .back {
        transform: rotate(0);
      }

      .front {
        transform: var(--rotation);
      }
    }
  }

  &--manual#{&}--is-back {
    .back {
      transform: rotate(0);
    }

    .front {
      transform: var(--rotation);
    }
  }

  &--horizontal {
    --rotation: rotateY(180deg);
  }

  &--vertical {
    --rotation: rotateX(180deg);
  }
}