Skip to content

Commit a08f847

Browse files
7 - Using the Navbar Recipe
1 parent d22a93d commit a08f847

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

Diff for: assets/logo.jpg

4.95 KB
Loading

Diff for: full_stack_python/full_stack_python.py

+83-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,89 @@ def handle_title_input_change(self, val):
1515
def did_click(self):
1616
print("Hello world did click")
1717

18+
def navbar_link(text: str, url: str) -> rx.Component:
19+
return rx.link(
20+
rx.text(text, size="4", weight="medium"), href=url
21+
)
22+
23+
1824
def navbar() -> rx.Component:
19-
return rx.heading("SaaS", size="9"),
25+
return rx.box(
26+
rx.desktop_only(
27+
rx.hstack(
28+
rx.hstack(
29+
rx.image(
30+
src="/logo.jpg",
31+
width="2.25em",
32+
height="auto",
33+
border_radius="25%",
34+
),
35+
rx.heading(
36+
"Reflex", size="7", weight="bold"
37+
),
38+
align_items="center",
39+
),
40+
rx.hstack(
41+
navbar_link("Home", "/#"),
42+
navbar_link("About", "/#"),
43+
navbar_link("Pricing", "/#"),
44+
navbar_link("Contact", "/#"),
45+
spacing="5",
46+
),
47+
rx.hstack(
48+
rx.button(
49+
"Sign Up",
50+
size="3",
51+
variant="outline",
52+
),
53+
rx.button("Log In", size="3"),
54+
spacing="4",
55+
justify="end",
56+
),
57+
justify="between",
58+
align_items="center",
59+
),
60+
),
61+
rx.mobile_and_tablet(
62+
rx.hstack(
63+
rx.hstack(
64+
rx.image(
65+
src="/logo.jpg",
66+
width="2em",
67+
height="auto",
68+
border_radius="25%",
69+
),
70+
rx.heading(
71+
"Reflex", size="6", weight="bold"
72+
),
73+
align_items="center",
74+
),
75+
rx.menu.root(
76+
rx.menu.trigger(
77+
rx.icon("menu", size=30)
78+
),
79+
rx.menu.content(
80+
rx.menu.item("Home"),
81+
rx.menu.item("About"),
82+
rx.menu.item("Pricing"),
83+
rx.menu.item("Contact"),
84+
rx.menu.separator(),
85+
rx.menu.item("Log in"),
86+
rx.menu.item("Sign up"),
87+
),
88+
justify="end",
89+
),
90+
justify="between",
91+
align_items="center",
92+
),
93+
),
94+
bg=rx.color("accent", 3),
95+
padding="1em",
96+
# position="fixed",
97+
# top="0px",
98+
# z_index="5",
99+
width="100%",
100+
)
20101

21102
def base_page(child: rx.Component, hide_navbar=False, *args, **kwargs) -> rx.Component:
22103
# print([type(x) for x in args])
@@ -59,8 +140,7 @@ def index() -> rx.Component:
59140
spacing="5",
60141
justify="center",
61142
min_height="85vh",
62-
),
63-
hide_navbar=True
143+
)
64144
)
65145

66146

0 commit comments

Comments
 (0)