1
0

custom.py 892 B

1234567891011121314151617181920212223242526
  1. from nicegui import ui
  2. from navbar import navbar
  3. class page(ui.page):
  4. def __init__(self, route: str, **kwargs) -> None:
  5. '''Custom page decorator to share the same styling and behavior across all pages'''
  6. super().__init__(route, classes='fit column items-start', title='Modularization Demo')
  7. self.kwargs = kwargs
  8. async def header(self) -> None:
  9. await super().header()
  10. navbar(**self.kwargs)
  11. # start using a ui row to let all content between header and footer be centered
  12. self.content = ui.row().classes('justify-center fit mt-10').__enter__()
  13. async def footer(self) -> None:
  14. await super().footer()
  15. # closing the row which was opened in header
  16. self.content.__exit__(None, None, None)
  17. def headline(text: str) -> ui.label:
  18. return ui.label(text).classes('text-h4 text-weight-bold text-grey-8')