Skip to content

Commit c9cd51e

Browse files
committed
refactor: move animations to within the component styles
1 parent 2008565 commit c9cd51e

2 files changed

Lines changed: 35 additions & 33 deletions

File tree

src/app.css

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,3 @@
1010
* {
1111
transition: color 0.15s, background-color 0.15s;
1212
}
13-
14-
.roll-in, .roll-out {
15-
animation-duration: 250ms;
16-
animation-timing-function: ease-out;
17-
animation-fill-mode: forwards;
18-
}
19-
20-
.roll-in {
21-
animation-name: roll-in;
22-
}
23-
24-
.roll-out {
25-
animation-name: roll-out;
26-
}
27-
28-
@keyframes roll-in {
29-
from {
30-
transform: translateX(-40px) rotate(-0.25turn);
31-
}
32-
to {
33-
transform: translateX(0) rotate(0turn);
34-
}
35-
}
36-
37-
@keyframes roll-out {
38-
from {
39-
transform: translateX(0) rotate(0turn);
40-
}
41-
to {
42-
transform: translateX(-40px) rotate(-0.25turn);
43-
}
44-
}
45-

src/lib/components/ThemeToggle.svelte

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,39 @@
8383
.hover-expand:hover {
8484
scale: 110%;
8585
}
86+
87+
:global {
88+
.roll-in,
89+
.roll-out {
90+
animation-duration: 250ms;
91+
animation-timing-function: ease-out;
92+
animation-fill-mode: forwards;
93+
}
94+
95+
.roll-in {
96+
animation-name: roll-in;
97+
}
98+
99+
.roll-out {
100+
animation-name: roll-out;
101+
}
102+
103+
@keyframes roll-in {
104+
from {
105+
transform: translateX(-40px) rotate(-0.25turn);
106+
}
107+
to {
108+
transform: translateX(0) rotate(0turn);
109+
}
110+
}
111+
112+
@keyframes roll-out {
113+
from {
114+
transform: translateX(0) rotate(0turn);
115+
}
116+
to {
117+
transform: translateX(-40px) rotate(-0.25turn);
118+
}
119+
}
120+
}
86121
</style>

0 commit comments

Comments
 (0)