1010from reflex_site_shared .views .sidebar import navbar_sidebar_button
1111
1212XY_REPOSITORY_URL = "https://github.com/reflex-dev/xy"
13- XY_GITHUB_STARS = 5
1413
15- _REFLEX_NAV_LINKS = (
16- ("Overview" , "/docs/" ),
17- ("Build with AI" , "/docs/ai/overview/best-practices/" ),
18- ("Framework" , "/docs/getting-started/introduction/" ),
19- ("Cloud" , "/docs/hosting/deploy-quick-start/" ),
14+ _XY_NAV_LINKS = (
15+ ("Overview" , "/docs/xy/" ),
16+ ("Reflex Integration" , "/docs/xy/integrations/reflex/" ),
2017)
2118
2219
@@ -62,37 +59,47 @@ def xy_docs_logo() -> rx.Component:
6259 )
6360
6461
65- def _menu_item (label : str , href : str , * , active : bool = False ) -> rx .Component :
62+ def _menu_item (label : str , href : str ) -> rx .Component :
6663 """Render one desktop navbar item with the official treatment.
6764
6865 Args:
6966 label: Visible item label.
7067 href: Destination URL.
71- active: Whether to render the active section underline.
7268
7369 Returns:
7470 Official-style navigation menu item.
7571 """
76- active_class = (
77- "shadow-[inset_0_-1px_0_0_var(--primary-10)] "
78- "[&_button]:text-primary-10 [&_div]:text-primary-10"
79- if active
80- else ""
81- )
8272 return ui .navigation_menu .item (
8373 rx .el .elements .a (
8474 button (label , size = "sm" , variant = "ghost" , native_button = False ),
8575 href = href ,
8676 class_name = "no-underline" ,
8777 ),
88- class_name = ui .cn (
89- "hidden h-full items-center justify-center md:flex" ,
90- active_class ,
91- ),
78+ class_name = "hidden h-full items-center justify-center md:flex" ,
9279 custom_attrs = {"role" : "menuitem" },
9380 )
9481
9582
83+ def _github_button () -> rx .Component :
84+ """Render the external XY repository link."""
85+ label = "View XY on GitHub"
86+ return rx .el .elements .a (
87+ button (
88+ get_icon (icon = "github_navbar" , class_name = "size-4 shrink-0" ),
89+ "GitHub" ,
90+ custom_attrs = {"aria-label" : label },
91+ size = "sm" ,
92+ variant = "primary" ,
93+ native_button = False ,
94+ class_name = "whitespace-nowrap" ,
95+ ),
96+ href = XY_REPOSITORY_URL ,
97+ target = "_blank" ,
98+ rel = "noopener noreferrer" ,
99+ aria_label = label ,
100+ )
101+
102+
96103def _navigation_menu () -> rx .Component :
97104 """Render the official desktop controls and mobile drawer trigger.
98105
@@ -101,8 +108,7 @@ def _navigation_menu() -> rx.Component:
101108 """
102109 return ui .navigation_menu .root (
103110 ui .navigation_menu .list (
104- * (_menu_item (label , href ) for label , href in _REFLEX_NAV_LINKS ),
105- _menu_item ("XY" , "/docs/xy/" , active = True ),
111+ * (_menu_item (label , href ) for label , href in _XY_NAV_LINKS ),
106112 class_name = "m-0 flex h-full list-none flex-row items-center gap-2" ,
107113 custom_attrs = {"role" : "menubar" },
108114 ),
@@ -113,23 +119,9 @@ def _navigation_menu() -> rx.Component:
113119 custom_attrs = {"role" : "menuitem" },
114120 ),
115121 ui .navigation_menu .item (
116- rx .el .elements .a (
117- button (
118- get_icon (icon = "github_navbar" , class_name = "size-4 shrink-0" ),
119- str (XY_GITHUB_STARS ),
120- custom_attrs = {
121- "aria-label" : (f"View XY on GitHub - { XY_GITHUB_STARS } stars" )
122- },
123- size = "sm" ,
124- variant = "ghost" ,
125- ),
126- href = XY_REPOSITORY_URL ,
127- target = "_blank" ,
128- rel = "noopener noreferrer" ,
129- aria_label = f"View XY on GitHub - { XY_GITHUB_STARS } stars" ,
130- ),
122+ _github_button (),
131123 unstyled = True ,
132- class_name = "hidden xl :flex" ,
124+ class_name = "hidden md :flex" ,
133125 custom_attrs = {"role" : "menuitem" },
134126 ),
135127 ui .navigation_menu .item (
@@ -281,7 +273,6 @@ def xy_docs_navbar() -> rx.Component:
281273
282274
283275__all__ = [
284- "XY_GITHUB_STARS" ,
285276 "XY_REPOSITORY_URL" ,
286277 "xy_docs_logo" ,
287278 "xy_docs_navbar" ,
0 commit comments