|
@@ -74,6 +74,7 @@ def add_header(menu: Optional[ui.left_drawer] = None) -> None:
|
|
|
'Examples': '/#examples',
|
|
|
'Why?': '/#why',
|
|
|
}
|
|
|
+ dark_mode = ui.dark_mode().bind_value(app.storage.user, 'dark_mode')
|
|
|
with ui.header() \
|
|
|
.classes('items-center duration-200 p-0 px-4 no-wrap') \
|
|
|
.style('box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1)'):
|
|
@@ -82,19 +83,32 @@ def add_header(menu: Optional[ui.left_drawer] = None) -> None:
|
|
|
with ui.link(target=index_page).classes('row gap-4 items-center no-wrap mr-auto'):
|
|
|
svg.face().classes('w-8 stroke-white stroke-2 max-[550px]:hidden')
|
|
|
svg.word().classes('w-24')
|
|
|
- with ui.row().classes('max-lg:hidden'):
|
|
|
+
|
|
|
+ with ui.row().classes('max-[1050px]:hidden'):
|
|
|
for title, target in menu_items.items():
|
|
|
ui.link(title, target).classes(replace='text-lg text-white')
|
|
|
+
|
|
|
search = Search()
|
|
|
search.create_button()
|
|
|
- with ui.link(target='https://discord.gg/TEpFeAaF4f').classes('max-[445px]:hidden').tooltip('Discord'):
|
|
|
+
|
|
|
+ with ui.element().classes('max-[360px]:hidden'):
|
|
|
+ ui.button(icon='dark_mode', on_click=lambda: dark_mode.set_value(None)) \
|
|
|
+ .props('flat fab-mini color=white').bind_visibility_from(dark_mode, 'value', value=True)
|
|
|
+ ui.button(icon='light_mode', on_click=lambda: dark_mode.set_value(True)) \
|
|
|
+ .props('flat fab-mini color=white').bind_visibility_from(dark_mode, 'value', value=False)
|
|
|
+ ui.button(icon='brightness_auto', on_click=lambda: dark_mode.set_value(False)) \
|
|
|
+ .props('flat fab-mini color=white').bind_visibility_from(dark_mode, 'value', lambda mode: mode is None)
|
|
|
+
|
|
|
+ with ui.link(target='https://discord.gg/TEpFeAaF4f').classes('max-[455px]:hidden').tooltip('Discord'):
|
|
|
svg.discord().classes('fill-white scale-125 m-1')
|
|
|
- with ui.link(target='https://www.reddit.com/r/nicegui/').classes('max-[395px]:hidden').tooltip('Reddit'):
|
|
|
+ with ui.link(target='https://www.reddit.com/r/nicegui/').classes('max-[405px]:hidden').tooltip('Reddit'):
|
|
|
svg.reddit().classes('fill-white scale-125 m-1')
|
|
|
- with ui.link(target='https://github.com/zauberzeug/nicegui/').tooltip('GitHub'):
|
|
|
+ with ui.link(target='https://github.com/zauberzeug/nicegui/').classes('max-[305px]:hidden').tooltip('GitHub'):
|
|
|
svg.github().classes('fill-white scale-125 m-1')
|
|
|
+
|
|
|
add_star().classes('max-[490px]:hidden')
|
|
|
- with ui.row().classes('lg:hidden'):
|
|
|
+
|
|
|
+ with ui.row().classes('min-[1051px]:hidden'):
|
|
|
with ui.button(icon='more_vert').props('flat color=white round'):
|
|
|
with ui.menu().classes('bg-primary text-white text-lg'):
|
|
|
for title, target in menu_items.items():
|
|
@@ -367,4 +381,4 @@ async def documentation_page_more(name: str, client: Client) -> None:
|
|
|
await client.connected()
|
|
|
await ui.run_javascript(f'document.title = "{name} • NiceGUI";', respond=False)
|
|
|
|
|
|
-ui.run(uvicorn_reload_includes='*.py, *.css, *.html', dark=None)
|
|
|
+ui.run(uvicorn_reload_includes='*.py, *.css, *.html')
|