File tree Expand file tree Collapse file tree 5 files changed +47
-5
lines changed
Expand file tree Collapse file tree 5 files changed +47
-5
lines changed Original file line number Diff line number Diff line change 11from . import routes
2+ from .state import NavState
3+
24
35__all__ = [
4- 'routes'
6+ 'routes' ,
7+ 'NavState'
58]
Original file line number Diff line number Diff line change 1+ import reflex as rx
2+
3+ from . import routes
4+
5+ class NavState (rx .State ):
6+ def to_home (self ):
7+ return rx .redirect (routes .HOME_ROUTE )
8+ def to_about_us (self ):
9+ return rx .redirect (routes .ABOUT_US_ROUTE )
10+ def to_contact (self ):
11+ return rx .redirect (routes .CONTACT_US_ROUTE )
12+ def to_pricing (self ):
13+ return rx .redirect (routes .PRICING_ROUTE )
14+
Original file line number Diff line number Diff line change 11from .about import about_page
22from .pricing import pricing_page
3+ from .contact import contact_page
34
45__all__ = [
56 'about_page' ,
7+ 'contact_page' ,
68 'pricing_page'
79]
Original file line number Diff line number Diff line change 1+ import reflex as rx
2+
3+ from .. import navigation
4+ from ..ui .base import base_page
5+
6+ @rx .page (route = navigation .routes .CONTACT_US_ROUTE )
7+ def contact_page () -> rx .Component :
8+ my_child = rx .vstack (
9+ rx .heading ("Contact Us" , size = "9" ),
10+ rx .text (
11+ "Something cool about us." ,
12+ ),
13+ spacing = "5" ,
14+ justify = "center" ,
15+ align = "center" ,
16+ min_height = "85vh" ,
17+ id = 'my-child'
18+ )
19+ return base_page (my_child )
Original file line number Diff line number Diff line change @@ -71,10 +71,14 @@ def navbar() -> rx.Component:
7171 rx .icon ("menu" , size = 30 )
7272 ),
7373 rx .menu .content (
74- rx .menu .item ("Home" ),
75- rx .menu .item ("About" ),
76- rx .menu .item ("Pricing" ),
77- rx .menu .item ("Contact" ),
74+ rx .menu .item ("Home" ,
75+ on_click = navigation .NavState .to_home ),
76+ rx .menu .item ("About" ,
77+ on_click = navigation .NavState .to_about_us ),
78+ rx .menu .item ("Pricing" ,
79+ on_click = navigation .NavState .to_pricing ),
80+ rx .menu .item ("Contact" ,
81+ on_click = navigation .NavState .to_contact ),
7882 rx .menu .separator (),
7983 rx .menu .item ("Log in" ),
8084 rx .menu .item ("Sign up" ),
You can’t perform that action at this time.
0 commit comments