Add a toggle between dark and light theme

This commit is contained in:
Greg Burri 2025-03-31 15:31:06 +02:00
parent d22617538e
commit 559ed139aa
34 changed files with 640 additions and 469 deletions

View file

@ -5,29 +5,37 @@
{% include "title.html" %}
<span class="header-menu">
{% match user %}
{% match context.user %}
{% when Some with (user) %}
<a class="create-recipe" href="/recipe/new" >{{ tr.t(Sentence::CreateNewRecipe) }}</a>
<a href="/{{ tr.current_lang_code() }}/user/edit">
<a class="create-recipe" href="/recipe/new" >{{ context.tr.t(Sentence::CreateNewRecipe) }}</a>
<a href="/{{ context.tr.current_lang_code() }}/user/edit">
{% if user.name == "" %}
{{ user.email }}
{% else %}
{{ user.name }}
{% endif %}
</a> / <a href="/signout">{{ tr.t(Sentence::SignOut) }}</a>
</a> / <a href="/signout">{{ context.tr.t(Sentence::SignOut) }}</a>
{% when None %}
<a href="/{{ tr.current_lang_code() }}/signin" >{{ tr.t(Sentence::SignInMenu) }}</a>/<a href="/{{ tr.current_lang_code() }}/signup">{{ tr.t(Sentence::SignUpMenu) }}</a>/<a href="/{{ tr.current_lang_code() }}/ask_reset_password">{{ tr.t(Sentence::LostPassword) }}</a>
<a href="/{{ context.tr.current_lang_code() }}/signin" >{{ context.tr.t(Sentence::SignInMenu) }}</a>/<a href="/{{ context.tr.current_lang_code() }}/signup">{{ context.tr.t(Sentence::SignUpMenu) }}</a>/<a href="/{{ context.tr.current_lang_code() }}/ask_reset_password">{{ context.tr.t(Sentence::LostPassword) }}</a>
{% endmatch %}
<select id="select-website-language">
{% for lang in translation::available_languages() %}
<option value="{{ lang.0 }}"
{%~ if tr.current_lang_code() == lang.0 %}
{%~ if context.tr.current_lang_code() == lang.0 %}
selected
{% endif %}
>{{ lang.1 }}</option>
{% endfor %}
</select>
<label id="toggle-theme">
<input type="checkbox"
{%~ if !context.dark_theme %}
checked
{% endif %} >
<span class="slider"></span>
</label>
</span>
</div>