diff --git a/src/components/Sidebar/Sidebar.css b/src/components/Sidebar/Sidebar.css index 872b549..3280fbe 100644 --- a/src/components/Sidebar/Sidebar.css +++ b/src/components/Sidebar/Sidebar.css @@ -5,6 +5,7 @@ top: var(--topbar-h); left: 0; bottom: 0; + z-index: 30; width: var(--sidebar-width-collapsed); @@ -14,9 +15,7 @@ background: var(--bg-void); border-right: var(--border-width) solid var(--border-hairline); - z-index: 30; overflow: visible; - transition: width var(--dur-base) var(--ease-standard); user-select: none; @@ -53,15 +52,14 @@ aspect-ratio: 1; height: calc(var(--header-height) * 0.7); + padding: 0; border: var(--border-width-active) solid transparent; border-radius: var(--radius-pill); background: var(--bg-void); color: var(--text-muted); - cursor: pointer; - padding: 0; transition: background var(--dur-base) var(--ease-standard), @@ -85,6 +83,8 @@ transform: rotate(180deg); } +/* ---------- App combobox ---------- */ + .sidebar-app-combobox { position: relative; flex: 1 1 auto; @@ -106,13 +106,9 @@ transition-delay: var(--dur-fast); } -.sidebar-app-trigger { +.sidebar-app-trigger, +.sidebar-app-input { width: 100%; - display: flex; - align-items: center; - justify-content: space-between; - gap: var(--space-2); - height: calc(var(--header-height) * 0.6); padding: 0 var(--space-2); @@ -124,6 +120,13 @@ font-family: var(--font-ui); font-size: var(--font-xs); font-weight: var(--font-weight-semibold); +} + +.sidebar-app-trigger { + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-2); cursor: pointer; transition: border-color var(--dur-base) var(--ease-standard); @@ -134,6 +137,11 @@ border-color: var(--accent-brand); } +.sidebar-app-input { + border-color: var(--accent-brand); + outline: none; +} + .sidebar-app-trigger-label { overflow: hidden; text-overflow: ellipsis; @@ -150,23 +158,6 @@ transform: rotate(180deg); } -.sidebar-app-input { - width: 100%; - height: calc(var(--header-height) * 0.6); - padding: 0 var(--space-2); - - background: var(--bg-panel); - border: var(--border-width) solid var(--accent-brand); - border-radius: var(--radius-sm); - - color: var(--text-primary); - font-family: var(--font-ui); - font-size: var(--font-xs); - font-weight: var(--font-weight-semibold); - - outline: none; -} - .sidebar-app-listbox { position: absolute; top: calc(100% + var(--space-1)); @@ -206,17 +197,14 @@ color: var(--accent-brand); font-weight: var(--font-weight-semibold); } -.sidebar-rail--expanded .sidebar-app-select { - opacity: 1; - max-width: 200px; - padding-inline: var(--space-2); - pointer-events: auto; - transition-delay: var(--dur-fast); -} /* ---------- Scroll ---------- */ .sidebar-scroll { + /* Fade sizes are toggled by data-fade-top / data-fade-bottom */ + --fade-top: 0px; + --fade-bottom: 0px; + flex: 1 1 auto; min-height: 0; @@ -228,8 +216,28 @@ padding-block: var(--space-1) var(--space-3); overflow-y: auto; - -webkit-mask-image: linear-gradient(to bottom, transparent, black 0); - mask-image: linear-gradient(to bottom, transparent, black 0); + -webkit-mask-image: linear-gradient( + to bottom, + transparent, + black var(--fade-top), + black calc(100% - var(--fade-bottom)), + transparent + ); + mask-image: linear-gradient( + to bottom, + transparent, + black var(--fade-top), + black calc(100% - var(--fade-bottom)), + transparent + ); +} + +.sidebar-scroll[data-fade-top='true'] { + --fade-top: 24px; +} + +.sidebar-scroll[data-fade-bottom='true'] { + --fade-bottom: 24px; } .sidebar-rail--expanded .sidebar-scroll { @@ -237,54 +245,26 @@ padding-inline: var(--space-2); } -.sidebar-scroll[data-fade-top='true'] { - -webkit-mask-image: linear-gradient( - to bottom, - transparent, - black 24px, - black calc(100% - 24px), - black - ); - mask-image: linear-gradient(to bottom, transparent, black 24px, black calc(100% - 24px), black); -} -.sidebar-scroll[data-fade-bottom='true'] { - -webkit-mask-image: linear-gradient(to bottom, black, black calc(100% - 24px), transparent); - mask-image: linear-gradient(to bottom, black, black calc(100% - 24px), transparent); -} -.sidebar-scroll[data-fade-top='true'][data-fade-bottom='true'] { - -webkit-mask-image: linear-gradient( - to bottom, - transparent, - black 24px, - black calc(100% - 24px), - transparent - ); - mask-image: linear-gradient( - to bottom, - transparent, - black 24px, - black calc(100% - 24px), - transparent - ); -} - /* ---------- Item ---------- */ -.sidebar-item { +.sidebar-item, +.sidebar-item--editing { display: flex; align-items: center; justify-content: center; + flex: 0 0 auto; /* never shrink: let the list scroll instead */ gap: var(--sidebar-item-gap); aspect-ratio: 1; height: calc(var(--header-height) * 0.7); +} +.sidebar-item { border: var(--border-width-active) solid transparent; border-radius: var(--radius-lg); background: transparent; color: var(--text-muted); - cursor: pointer; transition: @@ -296,7 +276,7 @@ .sidebar-item:hover { background: var(--bg-raised); color: var(--text-primary); - border: var(--border-width-active) solid var(--accent-brand); + border-color: var(--accent-brand); } .sidebar-item--active { @@ -310,6 +290,47 @@ padding-inline: var(--space-2); } +/* Editing state */ + +.sidebar-item--editing { + padding: 0; + border: none; + background: transparent; +} + +.sidebar-item-input { + width: 0; + flex: 1 1 auto; + min-width: 0; + max-width: 0; + + appearance: none; + -webkit-appearance: none; + background: transparent; + border: none; + outline: none; + box-shadow: none; + + text-align: center; + + color: var(--text-primary); + font-family: var(--font-ui); + font-size: var(--font-sm); + font-weight: var(--font-weight-semibold); + + opacity: 0; + + transition: + opacity var(--dur-fast) var(--ease-standard), + max-width var(--dur-base) var(--ease-standard); +} + +.sidebar-rail--expanded .sidebar-item-input { + width: auto; + max-width: 200px; + opacity: 1; +} + /* ---------- Icon ---------- */ .sidebar-icon { @@ -335,15 +356,15 @@ /* ---------- Label ---------- */ .sidebar-label { + flex: 1 1 auto; + min-width: 0; + max-width: 0; + font-size: var(--font-sm); white-space: nowrap; overflow: hidden; - flex: 1 1 auto; - min-width: 0; - opacity: 0; - max-width: 0; transition: opacity var(--dur-fast) var(--ease-standard), @@ -351,11 +372,11 @@ } .sidebar-rail--expanded .sidebar-label { - opacity: 1; max-width: 200px; + opacity: 1; } -/* ---------- Content ---------- */ +/* ---------- Content offset ---------- */ .stage--with-sidebar { margin-left: var(--sidebar-width-collapsed); @@ -366,58 +387,7 @@ margin-left: var(--sidebar-width-expanded); } -/* ---------- Item (editing state) ---------- */ - -.sidebar-item--editing { - display: flex; - align-items: center; - justify-content: center; - gap: var(--sidebar-item-gap); - - aspect-ratio: 1; - height: calc(var(--header-height) * 0.7); - - border: none; - - background: transparent; - padding: 0; -} - -.sidebar-item-input { - width: 0; - flex: 1 1 auto; - min-width: 0; - - appearance: none; - -webkit-appearance: none; - background: transparent; - border: none; - outline: none; - box-shadow: none; - - text-align: center; - - color: var(--text-primary); - font-family: var(--font-ui); - font-size: var(--font-sm); - font-weight: var(--font-weight-semibold); - - opacity: 0; - max-width: 0; - - transition: - opacity var(--dur-fast) var(--ease-standard), - max-width var(--dur-base) var(--ease-standard); -} - -.sidebar-rail--expanded .sidebar-item-input { - width: auto; - opacity: 1; - max-width: 200px; - border: none; -} - -/* ---------- Phone / touch ---------- */ +/* ---------- Touch devices ---------- */ .sidebar-backdrop { display: none; @@ -444,26 +414,28 @@ } @media (pointer: coarse) { - /* Cancel the global 44px min-height, sizes are set explicitly below */ + /* Cancel the global 44px min-height; sizes are set explicitly below */ .sidebar-rail button { min-height: 0; } - /* No iOS/Android callout menu on long-press (we use it for rename) */ + /* No iOS/Android callout menu on long-press (used for rename) */ .sidebar-item, .sidebar-app-trigger { -webkit-touch-callout: none; } } -@media (max-width: 768px) { +/* ---------- Phone (portrait + landscape) ---------- */ + +@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) { .sidebar-rail { - top: var(--topbar-h); - bottom: 0; + z-index: 50; /* above .sidebar-backdrop (45) */ padding-bottom: var(--safe-bottom); padding-left: var(--safe-left); width: var(--sidebar-rail-w); } + .sidebar-rail--expanded { width: calc(var(--sidebar-width-expanded) + var(--safe-left)); } @@ -475,8 +447,8 @@ left: 0; right: 0; bottom: 0; - background: rgba(0, 0, 0, 0.5); z-index: 45; + background: rgba(0, 0, 0, 0.5); } .sidebar-scroll { @@ -484,46 +456,57 @@ -webkit-overflow-scrolling: touch; } - /* Touch-sized items */ - .sidebar-item, - .sidebar-item--editing { - height: var(--touch-target); + /* Items: touch-sized, grow with content, fixed-size icon. + `.sidebar-rail` prefix beats `.sidebar-rail button { min-height: 0 }` */ + .sidebar-rail .sidebar-item, + .sidebar-rail .sidebar-item--editing { + aspect-ratio: auto; + height: auto; + min-height: var(--touch-target); + width: var(--touch-target); } - .sidebar-rail--expanded .sidebar-item { + + .sidebar-rail--expanded .sidebar-item, + .sidebar-rail--expanded .sidebar-item--editing { width: 100%; } + + .sidebar-icon { + aspect-ratio: auto; + width: calc(var(--touch-target) * 0.5); + height: calc(var(--touch-target) * 0.5); + } + + .sidebar-label, + .sidebar-item-input { + font-size: max(16px, var(--font-sm)); /* >= 16px prevents iOS focus-zoom */ + } + .sidebar-toggle { height: calc(var(--touch-target) * 0.9); } - /* Preset dropdown */ + /* App dropdown */ .sidebar-app-trigger, .sidebar-app-input { height: calc(var(--touch-target) * 0.9); } - .sidebar-app-input, - .sidebar-item-input { + + .sidebar-app-trigger { + font-size: max(13px, var(--font-xs)); + } + + .sidebar-app-input { font-size: 16px; /* prevents iOS focus-zoom */ } + .sidebar-app-listbox { max-height: min(240px, 50dvh); -webkit-overflow-scrolling: touch; } + .sidebar-app-option { padding: var(--space-3) var(--space-2); - font-size: var(--font-sm); - } -} - -@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) { - .sidebar-label, - .sidebar-item-input { - font-size: max(20px, var(--font-sm)); - } - - .sidebar-app-trigger, - .sidebar-app-input, - .sidebar-app-option { - font-size: max(13px, var(--font-xs)); + font-size: max(13px, var(--font-sm)); } } \ No newline at end of file