custom.py 743 B

123456789101112131415161718192021222324
  1. from nicegui import ui
  2. from navbar import navbar
  3. class page(ui.page):
  4. def __init__(self, route: str, **kwargs):
  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. self.content = ui.row().classes('justify-center fit mt-10').__enter__()
  12. async def footer(self) -> None:
  13. await super().footer()
  14. self.content.__exit__(None, None, None)
  15. def headline(text: str) -> ui.label:
  16. return ui.label(text).classes('text-h4 text-weight-bold text-grey-8')