Introduction
The following release introduces a minor fix, for layout, users can optionally pass layout to the router if they want the component life cycle methods to be synced on every mount.
from zenaura.client.app import Route, App
from zenaura.client.page import Page
from zenaura.client.layout import Layout
from public.routes import ClientRoutes
from public.components.header import Header
from public.components.intro import IntroSection
from public.components.footer import Footer
from public.components.examples import Example
# Instantiate components
nav_bar_header = Header(router)
intro_section = IntroSection()
footer = Footer()
example = Example()
# Define pages
home_page = Page([intro_section])
example_page = Page([example])
# Define routes
router.add_route(Route(
title="Developer-Focused | Zenaura",
path=ClientRoutes.home.value,
page=home_page
))
router.add_route(Route(
title="Example",
path=ClientRoutes.examples.value,
page=example_page
))
# Create the app layout
my_app_layout = Layout(
top=[nav_bar_header], # Components to appear before the routes
routes=app.routes, # Application routes (pages)
bottom=[footer] # Components to appear after the routes
)
# optional : pass layout to router to trigger global components attached lifecycle method
router.layout = my_app_layout