content.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from typing import Dict
  2. from nicegui import ui
  3. from .section import Section
  4. from .sections import (action_events, audiovisual_elements, binding_properties, configuration_deployment, controls,
  5. data_elements, page_layout, pages_routing, styling_appearance, text_elements)
  6. from .tools import heading
  7. SECTIONS: Dict[str, Section] = {
  8. section.name: section
  9. for section in [
  10. text_elements,
  11. controls,
  12. audiovisual_elements,
  13. data_elements,
  14. binding_properties,
  15. page_layout,
  16. styling_appearance,
  17. action_events,
  18. pages_routing,
  19. configuration_deployment,
  20. ]
  21. }
  22. def create_overview() -> None:
  23. with ui.grid().classes('grid-cols-[1fr] md:grid-cols-[1fr_1fr] xl:grid-cols-[1fr_1fr_1fr]'):
  24. for section in SECTIONS.values():
  25. with ui.link(target=f'/documentation/section_{section.name}/') \
  26. .classes('bg-[#5898d420] p-4 self-stretch rounded flex flex-col gap-2') \
  27. .style('box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1)'):
  28. ui.label(section.title).classes(replace='text-2xl')
  29. ui.markdown(section.description).classes(replace='bold-links arrow-links')
  30. def create_section(name: str) -> None:
  31. section = SECTIONS[name]
  32. heading(section.title)
  33. section.content()