def render_header(q: Q): q.page["title"] = ui.header_card( box='title', title=config.title, subtitle=config.subtitle, icon=config.icon, icon_color=config.icon_color, ) q.page["menu"] = ui.breadcrumbs_card( box='menu', items=[ ui.breadcrumb(name='home', label='Home'), ], )
async def serve(q: Q): if '#' in q.args: hash_ = q.args['#'] q.page['breadcrumbs'] = ui.form_card(box='1 1 2 5', items=[ ui.text(f'#={hash_}'), ui.button(name='show_breadcrumbs', label='Back', primary=True), ]) else: q.page['breadcrumbs'] = ui.breadcrumbs_card( box='1 1 4 1', items=[ ui.breadcrumb(name='#menu1', label='Menu 1'), ui.breadcrumb(name='#menu2', label='Menu 2'), ui.breadcrumb(name='#menu3', label='Menu 3'), ], ) await q.page.save()
async def serve(q: Q): blurb_items = [ ui.button(name='#submenu', label='Go to submenu', link=True) ] blurb_title = 'Welcome to Menu' breadcrumbs = [ui.breadcrumb(name='#menu', label='Menu')] if q.args['#'] == 'menu': blurb_items = [ ui.button(name='#submenu', label='Go to submenu', link=True) ] blurb_title = 'Welcome to Menu!' breadcrumbs = [ ui.breadcrumb(name='#menu', label='Menu'), ] elif q.args['#'] == 'submenu': blurb_items = [ ui.button(name='#subsubmenu', label='Go to subsubmenu', link=True) ] blurb_title = 'Welcome to Submenu!' breadcrumbs = [ ui.breadcrumb(name='#menu', label='Menu'), ui.breadcrumb(name='#submenu', label='Submenu'), ] elif q.args['#'] == 'subsubmenu': blurb_items = [ ui.text( 'You cannot go deeper, click on Breadcrumbs above to navigate back' ) ] blurb_title = 'Welcome to Subsubmenu!' breadcrumbs = [ ui.breadcrumb(name='#menu', label='Menu'), ui.breadcrumb(name='#submenu', label='Submenu'), ui.breadcrumb(name='#subsubmenu', label='Subsubmenu'), ] q.page['blurb'] = ui.form_card(box='1 2 3 2', title=blurb_title, items=blurb_items) q.page['breadcrumbs'] = ui.breadcrumbs_card(box='1 1 3 1', items=breadcrumbs) await q.page.save()