-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnavigation.py
110 lines (99 loc) · 2.76 KB
/
navigation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import reflex as rx
from reflex.components import lucide
from dashboard.styles import FONT_FAMILY
def sidebar_link(text: str, href: str, icon: str):
return rx.link(
rx.flex(
rx.icon_button(
rx.icon(tag=icon, weight=16, height=16),
variant="soft",
),
text,
py="2",
px="4",
spacing="3",
align="baseline",
direction="row",
font_family=FONT_FAMILY,
),
href=href,
width="100%",
border_radius="8px",
_hover={
"background": "rgba(255, 255, 255, 0.1)",
"backdrop_filter": "blur(10px)",
},
)
def sidebar(
*sidebar_links,
**props,
) -> rx.Component:
logo_src = props.get("logo_src", "/logo.jpg")
heading = props.get("heading", "NOT SET")
return rx.vstack(
rx.hstack(
rx.image(src=logo_src, height="28px", border_radius="8px"),
rx.heading(
heading,
font_family=FONT_FAMILY,
size="7",
),
width="100%",
spacing="7",
),
rx.divider(margin_y="3"),
rx.vstack(
*sidebar_links,
padding_y="1em",
),
width="250px",
position="fixed",
height="100%",
left="0px",
top="0px",
align_items="left",
z_index="10",
backdrop_filter="blur(10px)",
padding="2em",
)
dashboard_sidebar = sidebar(
sidebar_link(text="Dashboard", href="/", icon="bar_chart_3"),
sidebar_link(text="Tools", href="/tools", icon="settings"),
sidebar_link(text="Team", href="/team", icon="users"),
logo_src="/logo.jpg",
heading="REFLEX",
)
class State(rx.State):
pass
def navbar(heading: str) -> rx.Component:
return rx.hstack(
rx.heading(heading, font_family=FONT_FAMILY, size="7"),
rx.spacer(),
rx.menu.root(
rx.menu.trigger(
rx.button(
"Menu",
lucide.icon(tag="chevron_down", weight=16, height=16),
font_family=FONT_FAMILY,
variant="soft",
),
),
rx.menu.content(
rx.menu.item("Settings"),
rx.menu.item("Profile"),
rx.menu.item("Logout"),
font_family=FONT_FAMILY,
variant="soft",
),
variant="soft",
font_family=FONT_FAMILY,
),
position="fixed",
width="calc(100% - 250px)",
top="0px",
z_index="1000",
padding_x="2em",
padding_top="2em",
padding_bottom="1em",
backdrop_filter="blur(10px)",
)