diff --git a/resources/css/app.css b/resources/css/app.css index c3d46cc04..32d476c1a 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -4,20 +4,6 @@ @tailwind components; @tailwind utilities; -html { - font-size: 93.75%; -} - -:root { - --vh: 1vh; -} - -@screen lg { - html { - font-size: 87.5%; - } -} - html, body { @apply h-full bg-neutral-50 text-neutral-800 dark:bg-base dark:text-neutral-400 w-full; @@ -336,4 +322,4 @@ section { .dz-button { @apply w-full p-4 py-10 my-4 font-bold bg-white border dark:border-coolgray-400 dark:text-white dark:bg-transparent hover:dark:bg-coolgray-400; -} +} \ No newline at end of file diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index f635a6787..7d343c645 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -7,8 +7,13 @@ } window.location.reload(); }, + setZoom(zoom) { + localStorage.setItem('zoom', zoom); + window.location.reload(); + }, init() { this.full = localStorage.getItem('pageWidth'); + this.zoom = localStorage.getItem('zoom'); window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { const userSettings = localStorage.getItem('theme'); if (userSettings !== 'system') { @@ -21,6 +26,7 @@ } }); this.queryTheme(); + this.checkZoom(); }, setTheme(type) { this.theme = type; @@ -44,6 +50,30 @@ this.theme = 'system'; document.documentElement.classList.remove('dark'); } + }, + checkZoom() { + if (this.zoom === null) { + this.setZoom(100); + } + if (this.zoom === '90') { + const style = document.createElement('style'); + style.textContent = ` + html { + font-size: 93.75%; + } + + :root { + --vh: 1vh; + } + + @media (min-width: 1024px) { + html { + font-size: 87.5%; + } + } + `; + document.head.appendChild(style); + } } }">