This commit is contained in:
Thomas Chartron 2021-11-12 20:44:48 +01:00
parent 088847c4ee
commit c31dbb36c9
2 changed files with 3 additions and 4 deletions

View file

@ -42,13 +42,12 @@ function switchTheme() {
function toggleSidebar() {
let sidebar = document.getElementById('sidebar');
sidebar.classList.remove('hidden')
if ([...sidebar.classList].includes('translate-x-0')) {
document.body.style.setProperty("overflow", "hidden")
document.body.style.removeProperty("overflow")
sidebar.classList.remove('translate-x-0')
sidebar.classList.add('-translate-x-full')
} else {
document.body.style.removeProperty("overflow")
document.body.style.setProperty("overflow", "hidden")
sidebar.classList.remove('-translate-x-full')
sidebar.classList.add('translate-x-0')
}

View file

@ -139,7 +139,7 @@
</div>
{% endif %}
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:pr-0 ml-auto">
<button id="switch-theme" type="button" class="bg-gray-200 text-gray-800 hover:text-gray-900 dark:bg-gray-800 dark:text-gray-400 dark:hover:text-white p-1 rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white">
<span class="sr-only">Switch Theme</span>
<!-- Heroicon name: outline/light -->