Sidebar

merged…
osebo50d ago

I'd love the top nave to be represented as a sidebar, can you set this up?

image.png
image.png
4 repliesoldestnewest
Osebotfable-5-150d ago

Plan: turn the top bar into a left sidebar on wide screens, keep the existing compact modes below that.

  • header.top becomes a sticky, full-height left column (~220px) on viewports > 900px: wordmark on top, nav links stacked vertically underneath, user (avatar · name · sign out) pinned to the bottom. main sits to its right, still max-width 860px and centred in the remaining space.
  • 561–900px: unchanged inline top bar; ≤560px: unchanged ☰ panel. So phones/tablets aren't affected — this is purely additive CSS plus a tiny markup tweak (components/site-nav.tsx / app/layout.tsx stay the single source of nav links).
  • Will mock it up against the real globals.css and attach before/after screenshots.
Osebotfable-5-150d agothreadide@4dbd9f9

Done — the top nav is a left sidebar on wide screens. Pushed to thread/001850b7 (4dbd9f9); no PR opened yet, say the word if you want one.

What changed

  • app/globals.css: new @media (min-width: 901px) block. body becomes a flex row; header.top turns into a sticky, full-viewport-height 220px column (wordmark on top, nav links stacked with a 2px left-border marker on the current page, user avatar · name · sign out pinned to the bottom above a hairline). main sits to its right, still max 860px and centred in the remaining width. Width is --sidebar-w (default 220px) if you want to tune it.
  • app/layout.tsx: the user slot is now span.top-user instead of an inline marginLeft: auto so CSS can reflow it (margin-left:auto in bar mode, margin-top:auto in sidebar mode). .top-user:empty is hidden so the signed-out /signin page doesn't show a stray divider.
  • Nothing else moved: 561–900px keeps the inline top bar, ≤560px keeps the ☰ panel. Nav items still come from LINKS in components/site-nav.tsx.

Checked: tsc --noEmit clean; screenshots attached are static mockups of the home page against the real stylesheet at 1440px (dark + light), 800px and 390px — the app itself can't run in the sandbox (needs Postgres + GitHub OAuth), so please eyeball the thread page with the sticky reply dock once it deploys.

Note for later: the breakpoint is 900px because sidebar (220) + content (860) + gutters needs ~1150px to look relaxed; below that the inline bar is the better use of width.

Sidebar at 1440px, dark mode (static mockup against the real globals.css)
Sidebar at 1440px, dark mode (static mockup against the real globals.css)
Sidebar at 1440px, light mode
Sidebar at 1440px, light mode
800px: unchanged inline top bar
800px: unchanged inline top bar
390px: unchanged ☰ top bar
390px: unchanged ☰ top bar
Diff · 2 files
diff --git a/threadide/app/globals.css b/threadide/app/globals.css
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -125,7 +125,11 @@
-/* ---- header: LessWrong's flat white bar with the serif wordmark ---- */
+/* ---- header: LessWrong's flat white bar with the serif wordmark ----
+   Three modes from one markup ([SiteNav, h1, .top-user] inside header.top):
+   >900px  sidebar — see the min-width block right after the phone rules
+   561–900 top bar with inline links (the rules directly below)
+   ≤560px  top bar with a ☰ panel */
 header.top {
@@ -140,7 +144,8 @@
 .nav-links { display: flex; gap: 18px; order: 1; min-width: 0; margin-left: 8px; }
-header.top > span:last-child { order: 2; }
+.top-user { order: 2; margin-left: auto; }
+.top-user:empty { display: none; } /* signed-out (/signin): UserMenu renders nothing, so no stray divider in the sidebar */
@@ -185,6 +190,29 @@
+/* ---- sidebar: on wide screens the header turns into a sticky left column. body becomes a flex row so
+   main takes the rest; main keeps its 860px max and centres in the remaining width. The DOM order
+   [SiteNav, h1, .top-user] is reordered with flex `order` exactly like the top bar does. ---- */
+@media (min-width: 901px) {
+  body { display: flex; align-items: flex-start; min-height: 100vh; }
+  header.top {
+    position: sticky; top: 0; flex: 0 0 var(--sidebar-w, 220px); width: var(--sidebar-w, 220px); height: 100vh;
+    flex-direction: column; align-items: stretch; gap: 0; padding: 22px 18px 18px;
+    box-shadow: none; border-right: 1px solid var(--border); overflow-y: auto;
+  }
+  header.top h1 { font-size: 20px; padding: 0 8px; margin-bottom: 26px; }
+  .nav-links { flex-direction: column; gap: 2px; margin-left: 0; }
+  .nav-links a {
+    display: block; padding: 7px 8px; border-radius: 2px; font-size: 13px; border-left: 2px solid transparent;
+  }
+  .nav-links a:hover { background: var(--surface-hover); }
+  .nav-links a[aria-current="page"] { border-bottom: 0; border-left-color: var(--accent); }
+  .top-user { margin-left: 0; margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--border); }
+  .user-menu { display: flex; flex-wrap: wrap; row-gap: 4px; }
+  .user-menu form { margin-left: auto; }
+  main { flex: 1 1 auto; min-width: 0; padding: 32px 32px 80px; }
+}
+
diff --git a/threadide/app/layout.tsx b/threadide/app/layout.tsx
--- a/threadide/app/layout.tsx
+++ b/threadide/app/layout.tsx
@@ -27,16 +27,17 @@
-          {/* On phones SiteNav renders a ☰ button here, left of the title; the links themselves
-              are absolutely positioned under the header. On desktop the button is hidden and the
-              links display inline, so visually the order is title → links either way. */}
+          {/* >900px this header is a sticky left sidebar (wordmark, stacked links, user at the bottom).
+              561–900px it's a top bar with inline links. On phones SiteNav renders a ☰ button here,
+              left of the title, and the links become a panel under the bar. All three modes are pure
+              CSS over this one markup (see "header" in globals.css). */}
           <SiteNav />
@@
-          <span style={{ marginLeft: "auto" }}>
+          <span className="top-user">
             <UserMenu user={user} />
           </span>
oseboasked Osebot50d ago

get rid of that little line next to the selected menu option, otherwise it's good

image.png
image.png
Osebotfable-5-150d agothreadide@cdd1e60

Removed the line. Pushed to thread/001850b7 (cdd1e60).

What changed — app/globals.css, inside the @media (min-width: 901px) sidebar block: dropped the border-left: 2px solid transparent on sidebar links and the border-left-color: var(--accent) on the current one. The selected page is now shown by text colour + font-weight: 600 only (underline from the top-bar mode is still zeroed so it doesn't leak in). Top bar (561–900px) and ☰ panel (≤560px) are untouched.

One-line CSS change, so no new screenshot; still no PR opened — say the word if you want one.

Diff · 1 files
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -205,10 +205,11 @@
   .nav-links a {
-    display: block; padding: 7px 8px; border-radius: 2px; font-size: 13px; border-left: 2px solid transparent;
+    display: block; padding: 7px 8px; border-radius: 2px; font-size: 13px;
   }
   .nav-links a:hover { background: var(--surface-hover); }
-  .nav-links a[aria-current="page"] { border-bottom: 0; border-left-color: var(--accent); }
+  /* Current page = text colour + weight only; no underline/edge marker in the sidebar. */
+  .nav-links a[aria-current="page"] { border-bottom: 0; color: var(--text); font-weight: 600; }