diff --git a/ui/src/css/doc.css b/ui/src/css/doc.css index 5b6d813a50..2e5ff1241b 100644 --- a/ui/src/css/doc.css +++ b/ui/src/css/doc.css @@ -32,6 +32,11 @@ } } +/* Fluid width mode - removes max-width constraint */ +.doc--fluid { + max-width: 100% !important; +} + /* === HEADING STYLES === */ .doc h1, .doc h2, diff --git a/ui/src/css/main.css b/ui/src/css/main.css index 4f523465b4..086319ca69 100644 --- a/ui/src/css/main.css +++ b/ui/src/css/main.css @@ -70,3 +70,10 @@ body.-toc aside.toc.sidebar { max-width: calc(var(--doc-max-width--desktop) + var(--toc-width--widescreen)); /* Article + wider TOC */ } } + +/* Fluid width mode - remove main max-width constraints */ +@media screen and (min-width: 1280px) { + main:has(.doc--fluid) { + max-width: none; + } +} diff --git a/ui/src/js/12-width-toggle.js b/ui/src/js/12-width-toggle.js new file mode 100644 index 0000000000..2f878c8494 --- /dev/null +++ b/ui/src/js/12-width-toggle.js @@ -0,0 +1,37 @@ +/** + * Width Toggle + * Handles toggling between fixed and fluid article width + */ + +;(function () { + 'use strict' + + const STORAGE_KEY = 'article-width-mode' + const FLUID_CLASS = 'doc--fluid' + const ACTIVE_CLASS = 'bg-gray-200' + + document.addEventListener('DOMContentLoaded', function () { + const toggleButton = document.getElementById('width-toggle') + const articleElement = document.querySelector('article.doc') + + if (!toggleButton || !articleElement) { + return + } + + // Check for saved preference + const savedMode = localStorage.getItem(STORAGE_KEY) + if (savedMode === 'fluid') { + articleElement.classList.add(FLUID_CLASS) + toggleButton.classList.add(ACTIVE_CLASS) + } + + // Handle toggle click + toggleButton.addEventListener('click', function () { + const isFluid = articleElement.classList.toggle(FLUID_CLASS) + toggleButton.classList.toggle(ACTIVE_CLASS, isFluid) + + // Save preference + localStorage.setItem(STORAGE_KEY, isFluid ? 'fluid' : 'fixed') + }) + }) +})() diff --git a/ui/src/partials/header-content.hbs b/ui/src/partials/header-content.hbs index 56e51ad0f5..dd73eb1f7d 100644 --- a/ui/src/partials/header-content.hbs +++ b/ui/src/partials/header-content.hbs @@ -16,6 +16,9 @@