Skip to content

Commit 78fbbfa

Browse files
fix: improve buttons animations
1 parent 1a0b414 commit 78fbbfa

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/components/Button.astro

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import { motion } from 'motion/react'
32
import { getTitleAnimation } from '../animations'
43
54
const {
@@ -15,15 +14,15 @@ const {
1514

1615
{
1716
href ? (
18-
<motion.a
19-
className="transition-bg h-fit flex items-center justify-center gap-2 rounded-full border-2 border-dark bg-dark p-2 text-sm text-paper shadow-sm hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
17+
<a
18+
className="transition-all h-fit flex items-center justify-center gap-2 rounded-full border-2 border-dark bg-dark p-2 text-sm text-paper shadow-sm hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
2019
client:load
2120
{...getTitleAnimation(0.2)}
2221
id={id}
2322
{...extra}
2423
href={href}
2524
class:list={[
26-
'transition-bg flex items-center justify-center gap-2 rounded-full px-6 py-2 transition-transform duration-200',
25+
'transition-bg flex items-center justify-center gap-2 rounded-full px-6 py-2 transition-all duration-200',
2726
className,
2827
isPrimary
2928
? 'border-2 border-dark bg-dark text-paper hover:bg-paper hover:text-dark'
@@ -35,19 +34,19 @@ const {
3534
]}
3635
>
3736
<slot />
38-
</motion.a>
37+
</a>
3938
) : (
40-
<motion.button
41-
className="transition-bg h-fit flex items-center justify-center gap-2 rounded-full border-2 border-dark bg-dark p-2 text-sm text-paper shadow-sm hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
39+
<button
40+
className="transition-all h-fit flex items-center justify-center gap-2 rounded-full border-2 border-dark bg-dark p-2 text-sm text-paper shadow-sm hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
4241
client:load
4342
{...getTitleAnimation(0.2)}
4443
id={id}
4544
{...extra}
4645
class:list={[
47-
'flex items-center justify-center gap-2 rounded-full px-6 py-2 transition-transform duration-200',
46+
'transition-bg flex items-center justify-center gap-2 rounded-full px-6 py-2 transition-all duration-200',
4847
className,
4948
isPrimary
50-
? 'bg-dark text-paper'
49+
? 'border-2 border-dark bg-dark text-paper hover:bg-paper hover:text-dark'
5150
: isAlert
5251
? 'bg-red-300 text-dark'
5352
: !isBordered
@@ -56,7 +55,7 @@ const {
5655
]}
5756
>
5857
<slot />
59-
</motion.button>
58+
</button>
6059
)
6160
}
6261
<style>

src/components/Hero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function getHeroTitleAnimation() {
2727
<div class="flex h-full flex-col items-center justify-center">
2828
<motion.a
2929
href="/download"
30-
className="transition-bg mb-10 flex items-center gap-2 rounded-full border-2 border-dark bg-dark px-2 py-1 text-sm text-paper shadow-sm hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
30+
className="mb-10 flex items-center gap-2 rounded-full border-2 border-dark bg-dark px-2 py-1 text-sm text-paper shadow-sm transition-all duration-200 ease-in-out hover:bg-paper hover:text-dark hover:duration-200 md:px-4"
3131
client:load
3232
{...getTitleAnimation(1.8)}
3333
>

0 commit comments

Comments
 (0)