Skip to content

Commit fdb5428

Browse files
12 - Using Link-based Navigation
1 parent 5023297 commit fdb5428

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

full_stack_python/full_stack_python.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def index() -> rx.Component:
2626
rx.code(f"{config.app_name}/{config.app_name}.py"),
2727
size="5",
2828
),
29+
# <button href='/about'></button>
30+
rx.link(rx.button("Check out our docs!"), href='/about'),
2931
# <input type='text' value='My value' />
3032
rx.input(
3133
default_value=State.label,

full_stack_python/ui/nav.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,28 @@ def navbar() -> rx.Component:
1111
rx.desktop_only(
1212
rx.hstack(
1313
rx.hstack(
14-
rx.image(
15-
src="/logo.jpg",
16-
width="2.25em",
17-
height="auto",
18-
border_radius="25%",
14+
rx.link(
15+
rx.image(
16+
src="/logo.jpg",
17+
width="2.25em",
18+
height="auto",
19+
border_radius="25%",
20+
),
21+
href='/'
1922
),
20-
rx.heading(
21-
"Reflex", size="7", weight="bold"
23+
rx.link(
24+
rx.heading(
25+
"Reflex", size="7", weight="bold"
26+
),
27+
href='/'
2228
),
2329
align_items="center",
2430
),
2531
rx.hstack(
26-
navbar_link("Home", "/#"),
27-
navbar_link("About", "/#"),
28-
navbar_link("Pricing", "/#"),
29-
navbar_link("Contact", "/#"),
32+
navbar_link("Home", "/"),
33+
navbar_link("About", "/about"),
34+
navbar_link("Pricing", "/pricing"),
35+
navbar_link("Contact", "/contact"),
3036
spacing="5",
3137
),
3238
rx.hstack(

0 commit comments

Comments
 (0)