Skip to content

Commit 15fe85e

Browse files
committed
remove that
1 parent b782a7a commit 15fe85e

2 files changed

Lines changed: 20 additions & 58 deletions

File tree

  • docs/app/reflex_docs/components/docpage/navbar/buttons
  • packages/reflex-site-shared/src/reflex_site_shared/views/sidebar

docs/app/reflex_docs/components/docpage/navbar/buttons/sidebar.py

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
from reflex_site_shared.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
77
from reflex_site_shared.views.hosting_banner import HostingBannerState
88

9-
_DRAWER_LINKS_DOCS = "/docs"
10-
_DRAWER_LINKS_TEMPLATES = "/templates"
11-
_DRAWER_LINKS_BLOG = "/blog"
12-
_DRAWER_LINKS_CUSTOMERS = "/customers"
13-
_DRAWER_LINKS_LIBRARY = "/docs/library"
14-
_DRAWER_LINKS_OPEN_SOURCE = "/open-source"
15-
_DRAWER_LINKS_HOSTING = "/hosting"
16-
_DRAWER_LINKS_PRICING = "/pricing"
17-
189

1910
def social_menu_item(
2011
icon: str,
@@ -49,29 +40,14 @@ def drawer_socials() -> rx.Component:
4940
)
5041

5142

52-
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
53-
router_path = rx.State.router.page.path
43+
def drawer_item(text: str, url: str) -> rx.Component:
5444
if not url.endswith("/"):
5545
url += "/"
56-
active = router_path.contains(active_str)
57-
if active_str == "docs":
58-
is_docs_home = (router_path == "/") | (router_path == "/index")
59-
active = rx.cond(
60-
is_docs_home,
61-
False,
62-
~router_path.contains("hosting")
63-
& ~router_path.contains("library")
64-
& ~router_path.contains("gallery")
65-
& ~router_path.startswith("/ai/")
66-
& ~router_path.startswith("/docs/ai/"),
67-
)
68-
if active_str == "":
69-
active = False
7046
return rx.el.elements.a(
7147
text,
7248
href=url,
7349
underline="none",
74-
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
50+
color="var(--c-slate-9)",
7551
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
7652
)
7753

@@ -84,16 +60,14 @@ def navbar_sidebar_drawer(trigger) -> rx.Component:
8460
rx.drawer.portal(
8561
rx.drawer.content(
8662
rx.box(
87-
drawer_item("Docs", _DRAWER_LINKS_DOCS, "docs"),
88-
drawer_item("Templates", _DRAWER_LINKS_TEMPLATES, "templates"),
89-
drawer_item("Blog", _DRAWER_LINKS_BLOG, "blog"),
90-
drawer_item("Case Studies", _DRAWER_LINKS_CUSTOMERS, "customers"),
91-
drawer_item("Components", _DRAWER_LINKS_LIBRARY, "library"),
92-
drawer_item(
93-
"Open Source", _DRAWER_LINKS_OPEN_SOURCE, "open-source"
94-
),
95-
drawer_item("Cloud", _DRAWER_LINKS_HOSTING, "hosting"),
96-
drawer_item("Pricing", _DRAWER_LINKS_PRICING, "pricing"),
63+
drawer_item("Docs", "/docs"),
64+
drawer_item("Templates", "/templates"),
65+
drawer_item("Blog", "/blog"),
66+
drawer_item("Case Studies", "/customers"),
67+
drawer_item("Components", "/docs/library"),
68+
drawer_item("Open Source", "/open-source"),
69+
drawer_item("Cloud", "/hosting"),
70+
drawer_item("Pricing", "/pricing"),
9771
drawer_socials(),
9872
rx.el.button(
9973
rx.color_mode.icon(

packages/reflex-site-shared/src/reflex_site_shared/views/sidebar/__init__.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,19 @@ def drawer_socials() -> rx.Component:
5353
)
5454

5555

56-
def drawer_item(text: str, url: str, active_str: str = "") -> rx.Component:
56+
def drawer_item(text: str, url: str) -> rx.Component:
5757
"""Drawer item.
5858
5959
Returns:
6060
The component.
6161
"""
62-
router_path = rx.State.router.page.path
6362
if not url.endswith("/"):
6463
url += "/"
65-
active = router_path.contains(active_str)
66-
if active_str == "docs":
67-
active = rx.cond(
68-
router_path.contains("hosting")
69-
| router_path.contains("library")
70-
| router_path.contains("gallery"),
71-
False,
72-
active,
73-
)
74-
if active_str == "":
75-
active = False
7664
return rx.el.elements.a(
7765
text,
7866
href=url,
7967
underline="none",
80-
color=rx.cond(active, "var(--c-violet-9)", "var(--c-slate-9)"),
68+
color="var(--c-slate-9)",
8169
class_name="flex justify-center items-center border-slate-4 px-4 py-[0.875rem] border-t-0 border-b border-solid w-full font-small hover:!text-violet-9 border-x-0",
8270
)
8371

@@ -95,14 +83,14 @@ def navbar_sidebar_drawer(trigger: rx.Component) -> rx.Component:
9583
rx.drawer.portal(
9684
rx.drawer.content(
9785
rx.box(
98-
drawer_item("Docs", "/docs", "docs"),
99-
drawer_item("Templates", "/templates", "templates"),
100-
drawer_item("Blog", "/blog", "blog"),
101-
drawer_item("Case Studies", "/customers", "customers"),
102-
drawer_item("Components", "/docs/library", "library"),
103-
drawer_item("Open Source", "/open-source", "open-source"),
104-
drawer_item("Cloud", "/hosting", "hosting"),
105-
drawer_item("Pricing", "/pricing", "pricing"),
86+
drawer_item("Docs", "/docs"),
87+
drawer_item("Templates", "/templates"),
88+
drawer_item("Blog", "/blog"),
89+
drawer_item("Case Studies", "/customers"),
90+
drawer_item("Components", "/docs/library"),
91+
drawer_item("Open Source", "/open-source"),
92+
drawer_item("Cloud", "/hosting"),
93+
drawer_item("Pricing", "/pricing"),
10694
drawer_socials(),
10795
rx.el.button(
10896
rx.color_mode.icon(

0 commit comments

Comments
 (0)