Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit a76ba1e

Browse files
authored
feat(button): added animation to buttons (#2589)
1 parent ba6bd93 commit a76ba1e

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

.changeset/fuzzy-badgers-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ebay/skin": minor
3+
---
4+
5+
feat(button): added animation to buttons

dist/button/button.css

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ button.btn--primary {
171171
var(--color-foreground-on-accent)
172172
);
173173
font-weight: 700;
174+
transition: all var(--motion-duration-short-3)
175+
var(--motion-easing-quick-enter);
176+
}
177+
a.fake-btn--primary:active,
178+
button.btn--primary:active {
179+
transform: scale(0.97);
174180
}
175181

176182
a.fake-btn--primary {
@@ -324,11 +330,19 @@ a.fake-btn--secondary,
324330
button.btn--secondary {
325331
background-color: var(--btn-secondary-background-color, transparent);
326332
border-color: var(--btn-secondary-border-color, var(--color-stroke-accent));
333+
color: var(
334+
--btn-secondary-foreground-color,
335+
var(--color-foreground-accent)
336+
);
337+
transition: all var(--motion-duration-short-3)
338+
var(--motion-easing-quick-enter);
339+
}
340+
a.fake-btn--secondary:active,
341+
button.btn--secondary:active {
342+
transform: scale(0.97);
327343
}
328344

329-
a.fake-btn--secondary,
330-
a.fake-btn--secondary:visited,
331-
button.btn--secondary {
345+
a.fake-btn--secondary:visited {
332346
color: var(
333347
--btn-secondary-foreground-color,
334348
var(--color-foreground-accent)
@@ -435,6 +449,12 @@ a.fake-btn--secondary[aria-disabled="true"] {
435449
a.fake-btn--tertiary,
436450
button.btn--tertiary {
437451
border-color: var(--btn-tertiary-border-color, var(--color-stroke-default));
452+
transition: all var(--motion-duration-short-3)
453+
var(--motion-easing-quick-enter);
454+
}
455+
a.fake-btn--tertiary:active,
456+
button.btn--tertiary:active {
457+
transform: scale(0.97);
438458
}
439459

440460
a.fake-btn--tertiary[href]:focus,

src/sass/button/button.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ a.fake-btn--primary {
124124
color-foreground-on-accent
125125
);
126126

127+
@include btn-animations();
128+
127129
font-weight: bold;
128130
}
129131

@@ -281,6 +283,8 @@ a.fake-btn--secondary {
281283
btn-secondary-foreground-color,
282284
color-foreground-accent
283285
);
286+
287+
@include btn-animations();
284288
}
285289

286290
a.fake-btn--secondary:visited {
@@ -388,6 +392,8 @@ a.fake-btn--tertiary {
388392
btn-tertiary-border-color,
389393
color-stroke-default
390394
);
395+
396+
@include btn-animations();
391397
}
392398

393399
button.btn--tertiary:not([disabled], [aria-disabled="true"]),

src/sass/mixins/private/_button-mixins.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,12 @@ $button-border-radius-large: 24px;
101101
@include btn-fixed-height();
102102
}
103103
}
104+
105+
@mixin btn-animations() {
106+
transition: all var(--motion-duration-short-3)
107+
var(--motion-easing-quick-enter);
108+
109+
&:active {
110+
transform: scale(0.97);
111+
}
112+
}

0 commit comments

Comments
 (0)