Merge branch 'dark-mode' into staging

This commit is contained in:
Marie Birner 2023-11-04 20:53:29 +01:00
commit 48f26a1379
2 changed files with 9 additions and 11 deletions

View File

@ -77,17 +77,15 @@ function colorThemeWatcher() {
function setTheme(theme: string, setLocalStorage = true) {
let toggleBtn = document.querySelector('#theme-toggle-js');
if(toggleBtn) {
if (setLocalStorage) {
localStorage.setItem('theme', theme);
}
toggleBtn.setAttribute('data-theme', theme);
if (setLocalStorage) {
localStorage.setItem('theme', theme);
}
if (toggleBtn) toggleBtn.setAttribute('data-theme', theme);
if (document.documentElement.classList.contains('dark') && theme === 'light') {
document.documentElement.classList.remove('dark');
} else if(theme === 'dark'){
document.documentElement.classList.add('dark');
}
if (document.documentElement.classList.contains('dark') && theme === 'light') {
document.documentElement.classList.remove('dark');
} else if(theme === 'dark'){
document.documentElement.classList.add('dark');
}
}

View File

@ -30,7 +30,7 @@
</header>
{% endif %}
<div class="flex min-h-screen {%if not loggedin_user and not show_kiosk_header %} items-center {% else %} items-start {% endif %} justify-center px-4 py-12 sm:px-6 lg:px-8"> {% block content %}{% endblock content %}
<div class="flex min-h-screen {%if not loggedin_user and not show_kiosk_header %} items-center dark:bg-primary-900 {% else %} items-start {% endif %} justify-center px-4 py-12 sm:px-6 lg:px-8"> {% block content %}{% endblock content %}
</div>
{% if loggedin_user %}