Skip to content

Commit bb40bf4

Browse files
authored
fix: goober keyframes (#335)
1 parent e1aaa98 commit bb40bf4

File tree

1 file changed

+79
-79
lines changed

1 file changed

+79
-79
lines changed

packages/devtools/src/styles/use-styles.ts

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,76 @@ import type { DevtoolsStore } from '../context/devtools-store'
99
const mSecondsToCssSeconds = (mSeconds: number) =>
1010
`${(mSeconds / 1000).toFixed(2)}s`
1111

12+
const fadeIn = goober.keyframes`
13+
from {
14+
opacity: 0;
15+
transform: translateY(10px);
16+
}
17+
to {
18+
opacity: 1;
19+
transform: translateY(0);
20+
}
21+
`
22+
23+
const slideInRight = goober.keyframes`
24+
from {
25+
transform: translateX(100%);
26+
}
27+
to {
28+
transform: translateX(0);
29+
}
30+
`
31+
32+
const slideUp = goober.keyframes`
33+
from {
34+
opacity: 0;
35+
transform: translateY(20px);
36+
}
37+
to {
38+
opacity: 1;
39+
transform: translateY(0);
40+
}
41+
`
42+
43+
const statusFadeIn = goober.keyframes`
44+
from {
45+
opacity: 0;
46+
}
47+
to {
48+
opacity: 1;
49+
}
50+
`
51+
52+
const iconPop = goober.keyframes`
53+
0% {
54+
transform: scale(0);
55+
}
56+
50% {
57+
transform: scale(1.2);
58+
}
59+
100% {
60+
transform: scale(1);
61+
}
62+
`
63+
64+
const spin = goober.keyframes`
65+
to {
66+
transform: rotate(360deg);
67+
}
68+
`
69+
70+
const sparkle = goober.keyframes`
71+
0%,
72+
100% {
73+
opacity: 1;
74+
transform: scale(1) rotate(0deg);
75+
}
76+
50% {
77+
opacity: 0.6;
78+
transform: scale(1.1) rotate(10deg);
79+
}
80+
`
81+
1282
const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
1383
const { colors, font, size, border } = tokens
1484
const { fontFamily, size: fontSize } = font
@@ -635,18 +705,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
635705
'linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)',
636706
'linear-gradient(135deg, #1a1d23 0%, #13161a 100%)',
637707
)};
638-
animation: fadeIn 0.3s ease;
639-
640-
@keyframes fadeIn {
641-
from {
642-
opacity: 0;
643-
transform: translateY(10px);
644-
}
645-
to {
646-
opacity: 1;
647-
transform: translateY(0);
648-
}
649-
}
708+
animation: ${fadeIn} 0.3s ease;
650709
`,
651710
pluginMarketplaceHeader: css`
652711
margin-bottom: 2rem;
@@ -792,16 +851,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
792851
z-index: 1000;
793852
display: flex;
794853
flex-direction: column;
795-
animation: slideInRight 0.3s ease;
796-
797-
@keyframes slideInRight {
798-
from {
799-
transform: translateX(100%);
800-
}
801-
to {
802-
transform: translateX(0);
803-
}
804-
}
854+
animation: ${slideInRight} 0.3s ease;
805855
`,
806856
pluginMarketplaceSettingsPanelHeader: css`
807857
display: flex;
@@ -842,18 +892,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
842892
display: grid;
843893
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
844894
gap: 1.25rem;
845-
animation: slideUp 0.4s ease;
846-
847-
@keyframes slideUp {
848-
from {
849-
opacity: 0;
850-
transform: translateY(20px);
851-
}
852-
to {
853-
opacity: 1;
854-
transform: translateY(0);
855-
}
856-
}
895+
animation: ${slideUp} 0.4s ease;
857896
`,
858897
pluginMarketplaceCard: css`
859898
background: ${t(colors.white, colors.darkGray[800])};
@@ -1041,33 +1080,12 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
10411080
align-items: center;
10421081
gap: 0.5rem;
10431082
color: ${t(colors.green[600], colors.green[400])};
1044-
animation: statusFadeIn 0.3s ease;
1045-
1046-
@keyframes statusFadeIn {
1047-
from {
1048-
opacity: 0;
1049-
}
1050-
to {
1051-
opacity: 1;
1052-
}
1053-
}
1083+
animation: ${statusFadeIn} 0.3s ease;
10541084
10551085
svg {
10561086
width: 18px;
10571087
height: 18px;
1058-
animation: iconPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
1059-
}
1060-
1061-
@keyframes iconPop {
1062-
0% {
1063-
transform: scale(0);
1064-
}
1065-
50% {
1066-
transform: scale(1.2);
1067-
}
1068-
100% {
1069-
transform: scale(1);
1070-
}
1088+
animation: ${iconPop} 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
10711089
}
10721090
`,
10731091
pluginMarketplaceCardSpinner: css`
@@ -1076,13 +1094,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
10761094
border: 2px solid ${t(colors.gray[200], colors.gray[700])};
10771095
border-top-color: ${t(colors.blue[600], colors.blue[400])};
10781096
border-radius: 50%;
1079-
animation: spin 0.8s linear infinite;
1080-
1081-
@keyframes spin {
1082-
to {
1083-
transform: rotate(360deg);
1084-
}
1085-
}
1097+
animation: ${spin} 0.8s linear infinite;
10861098
`,
10871099
pluginMarketplaceCardStatusText: css`
10881100
font-size: 0.875rem;
@@ -1099,7 +1111,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
10991111
background: ${t(colors.white, colors.darkGray[800])};
11001112
border: 2px dashed ${t(colors.gray[300], colors.gray[700])};
11011113
border-radius: 0.75rem;
1102-
animation: fadeIn 0.3s ease;
1114+
animation: ${fadeIn} 0.3s ease;
11031115
`,
11041116
pluginMarketplaceEmptyText: css`
11051117
font-size: 0.95rem;
@@ -1311,19 +1323,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
13111323
&::before {
13121324
content: '✨';
13131325
font-size: 0.875rem;
1314-
animation: sparkle 2s ease-in-out infinite;
1315-
}
1316-
}
1317-
1318-
@keyframes sparkle {
1319-
0%,
1320-
100% {
1321-
opacity: 1;
1322-
transform: scale(1) rotate(0deg);
1323-
}
1324-
50% {
1325-
opacity: 0.6;
1326-
transform: scale(1.1) rotate(10deg);
1326+
animation: ${sparkle} 2s ease-in-out infinite;
13271327
}
13281328
}
13291329
@@ -1336,7 +1336,7 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
13361336
border-left-color: ${t(colors.blue[500], colors.blue[400])};
13371337
13381338
h3::before {
1339-
animation: sparkle 0.5s ease-in-out infinite;
1339+
animation: ${sparkle} 0.5s ease-in-out infinite;
13401340
}
13411341
}
13421342

0 commit comments

Comments
 (0)