From 3f96769840868dd26b64c1dbfaafa2fdd455f167 Mon Sep 17 00:00:00 2001 From: jamey Date: Sat, 7 Mar 2026 11:36:18 +0000 Subject: [PATCH] refine editor sheet to floating pill button - collapsed state: floating pill button in bottom-right corner - removed panel background when collapsed (transparent) - violet accent colour to distinguish from shop theme - white glow outline for visibility on any background - consistent behaviour on mobile and desktop - opens to bottom sheet (mobile) or side panel (desktop) Co-Authored-By: Claude Opus 4.5 --- assets/css/admin/components.css | 118 +++++++++++++++----------------- assets/js/app.js | 1 + 2 files changed, 55 insertions(+), 64 deletions(-) diff --git a/assets/css/admin/components.css b/assets/css/admin/components.css index ea4636b..d4b33a4 100644 --- a/assets/css/admin/components.css +++ b/assets/css/admin/components.css @@ -2392,6 +2392,7 @@ } + @media (prefers-reduced-motion: reduce) { .editor-sheet { transition: none; @@ -2400,52 +2401,87 @@ /* ── Mobile: bottom-anchored ── */ @media (max-width: 767px) { + /* Collapsed: floating pill button, no panel background */ .editor-sheet { - bottom: 0; - left: 0; - right: 0; - height: 85dvh; - border-radius: var(--t-radius-lg, 12px) var(--t-radius-lg, 12px) 0 0; - transform: translateY(calc(100% - 48px)); + left: auto; + right: 16px; + bottom: 16px; + top: auto; + width: auto; + height: auto; + background: transparent; + box-shadow: none; + border: none; + border-radius: 0; } + /* Open: full panel from bottom */ .editor-sheet[data-state="open"] { - transform: translateY(0); + left: 0; + right: 0; + bottom: 0; + top: 15dvh; + width: auto; + height: auto; + background: var(--t-surface-base); + box-shadow: var(--t-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.15)); + border-radius: var(--t-radius-lg, 12px) var(--t-radius-lg, 12px) 0 0; + border: 1px solid var(--t-border-default); + border-bottom: none; } } /* ── Desktop: right-anchored ── */ +/* ── Desktop: same floating button, side panel when open ── */ @media (min-width: 768px) { + /* Collapsed: floating pill button, no panel background (same as mobile) */ .editor-sheet { + left: auto; + right: 16px; + bottom: 16px; + top: auto; + width: auto; + height: auto; + background: transparent; + box-shadow: none; + border: none; + border-radius: 0; + } + + /* Open: side panel from right */ + .editor-sheet[data-state="open"] { top: 0; right: 0; bottom: 0; - border-radius: var(--t-radius-lg, 12px) 0 0 var(--t-radius-lg, 12px); width: 420px; max-width: 90vw; - transform: translateX(calc(100% - 48px)); - flex-direction: column; - } - - .editor-sheet[data-state="open"] { - transform: translateX(0); + background: var(--t-surface-base); + box-shadow: var(--t-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.15)); + border-radius: var(--t-radius-lg, 12px) 0 0 var(--t-radius-lg, 12px); + border: 1px solid var(--t-border-default); + border-right: none; } } + /* ── Edit button in collapsed state ── */ .editor-sheet-edit-btn { display: flex; align-items: center; gap: 0.5rem; - padding: 0.375rem 0.75rem; - background: var(--t-accent); + padding: 0.5rem 0.875rem; + background: oklch(0.5 0.18 280); color: #fff; border: none; - border-radius: 6px; + border-radius: 9999px; font-size: 0.875rem; font-weight: 500; cursor: pointer; - transition: filter 0.15s; + transition: filter 0.15s, box-shadow 0.15s; + /* Soft glow for visibility over any background */ + box-shadow: + 0 2px 8px rgba(0, 0, 0, 0.2), + 0 0 0 3px rgba(255, 255, 255, 0.6); } .editor-sheet-edit-btn:hover { @@ -2458,52 +2494,6 @@ flex-shrink: 0; } -/* Desktop collapsed: icon-only button with tooltip */ -@media (min-width: 768px) { - .editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn { - padding: 0.5rem; - position: relative; - } - - .editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn span { - /* Visually hidden but accessible to screen readers */ - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - white-space: nowrap; - border: 0; - } - - /* Tooltip on hover - dark tooltip for visibility on any theme */ - .editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn::after { - content: "Edit page"; - position: absolute; - right: calc(100% + 8px); - top: 50%; - transform: translateY(-50%); - padding: 0.375rem 0.5rem; - background: #1a1a1a; - color: #fff; - font-size: 0.75rem; - font-weight: 500; - border-radius: 4px; - white-space: nowrap; - opacity: 0; - pointer-events: none; - transition: opacity 0.15s; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); - z-index: 10; - } - - .editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn:hover::after, - .editor-sheet[data-state="collapsed"] .editor-sheet-edit-btn:focus::after { - opacity: 1; - } -} /* ── Dirty indicator ── */ .editor-sheet-dirty { diff --git a/assets/js/app.js b/assets/js/app.js index 7bf75d0..018a03f 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -700,6 +700,7 @@ const EditorSheet = { } } document.addEventListener("keydown", this._onKeydown) + }, destroyed() {