Skip to content

Commit 952f1c7

Browse files
committed
Animación botón
1 parent c63e73a commit 952f1c7

File tree

3 files changed

+45
-55
lines changed

3 files changed

+45
-55
lines changed

link_bio/.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

link_bio/link_bio/components/link_button.py

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,46 @@
55
from link_bio.styles.styles import Size, Spacing
66

77

8-
def link_button(title: str,
9-
body: str,
10-
image: str,
11-
url: str,
12-
is_external=True,
13-
highlight_color=None,
14-
animated=False) -> rx.Component:
8+
def link_button(
9+
title: str,
10+
body: str,
11+
image: str,
12+
url: str,
13+
is_external=True,
14+
highlight_color=None,
15+
animated=False,
16+
) -> rx.Component:
1517

16-
return rx.button(
17-
rx.hstack(
18-
rx.image(
19-
src=image,
20-
width=Size.LARGE.value,
21-
height=Size.LARGE.value,
22-
margin=Size.MEDIUM.value,
23-
alt=title
24-
),
25-
rx.vstack(
26-
rx.text(
27-
title,
28-
size=Spacing.SMALL.value
18+
return rx.container(
19+
rx.button(
20+
rx.hstack(
21+
rx.image(
22+
src=image,
23+
width=Size.LARGE.value,
24+
height=Size.LARGE.value,
25+
margin=Size.MEDIUM.value,
26+
alt=title,
2927
),
30-
rx.text(
31-
body,
32-
size=Spacing.VERY_SMALL.value
28+
rx.vstack(
29+
rx.text(title, size=Spacing.SMALL.value),
30+
rx.text(body, size=Spacing.VERY_SMALL.value),
31+
align_items="start",
32+
spacing=Spacing.VERY_SMALL.value,
33+
padding_y=Size.SMALL.value,
34+
padding_right=Size.SMALL.value,
3335
),
34-
align_items="start",
35-
spacing=Spacing.VERY_SMALL.value,
36-
padding_y=Size.SMALL.value,
37-
padding_right=Size.SMALL.value
36+
align="center",
37+
width="100%",
38+
),
39+
variant="solid",
40+
radius="none",
41+
width="100%",
42+
background_color=(
43+
highlight_color if highlight_color is not None else Color.PRIMARY.value
3844
),
39-
align="center",
40-
width="100%"
45+
on_click=rx.redirect(path=url, is_external=is_external),
4146
),
42-
variant="solid",
43-
radius="none",
44-
background_color=highlight_color if highlight_color is not None else Color.PRIMARY.value,
45-
class_name=styles.BOUNCEIN_ANIMATION if animated else None,
46-
on_click=rx.redirect(path=url, is_external=is_external)
47+
class_name=styles.SHAKE_ANIMATION if animated else None,
48+
padding=0,
49+
width="100%",
4750
)

link_bio/link_bio/styles/styles.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
# Constants
99
MAX_WIDTH = "560px"
1010
FADEIN_ANIMATION = "animate__animated animate__fadeIn"
11-
BOUNCEIN_ANIMATION = "animate__animated animate__bounceIn"
11+
SHAKE_ANIMATION = "animate__animated animate__shakeX"
1212

1313
# Sizes
1414

1515
STYLESHEETS = [
1616
"https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;800&display=swap",
1717
"https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css",
18-
"/css/styles.css"
18+
"/css/styles.css",
1919
]
2020

2121

@@ -40,6 +40,7 @@ class Spacing(Enum):
4040
MEDIUM_BIG = "7"
4141
VERY_BIG = "9"
4242

43+
4344
# Styles
4445

4546

@@ -53,7 +54,7 @@ class Spacing(Enum):
5354
rx.heading: {
5455
"color": TextColor.LIGHT.value,
5556
"font_family": Font.DEFAULT.value,
56-
"font_weight": FontWeight.MEDIUM.value
57+
"font_weight": FontWeight.MEDIUM.value,
5758
},
5859
rx.button: {
5960
"width": "100%",
@@ -65,17 +66,9 @@ class Spacing(Enum):
6566
"color": Color.DARK.value,
6667
"border": f"1px solid {Color.LIGHT.value}",
6768
"box_shadow": f"3px 3px 0px 0px {Color.LIGHT.value}",
68-
"_hover": {
69-
"box_shadow": "none",
70-
"transform": "translate(3px, 3px)"
71-
}
69+
"_hover": {"box_shadow": "none", "transform": "translate(3px, 3px)"},
7270
},
73-
rx.link: {
74-
"color": TextColor.LIGHT.value,
75-
"text_decoration": "none",
76-
""
77-
"_hover": {}
78-
}
71+
rx.link: {"color": TextColor.LIGHT.value, "text_decoration": "none", "" "_hover": {}},
7972
}
8073

8174
title_style = dict(
@@ -90,6 +83,6 @@ class Spacing(Enum):
9083
"box_shadow": f"3px 3px 0px 0px {Color.LIGHT.value}",
9184
"_hover": {
9285
"box_shadow": f"6px 6px 0px 0px {Color.LIGHT.value}",
93-
"transform": "translate(-3px, -3px)"
94-
}
86+
"transform": "translate(-3px, -3px)",
87+
},
9588
}

0 commit comments

Comments
 (0)