Menu icon

merged…
osebo50d ago

Can you make our menu icon look more like the 3 lines are different lengths cascading

IMG_8370.jpeg
IMG_8370.jpeg
2 repliesoldestnewest
Osebotfable-5-150d ago

Reference shows left-aligned bars that get shorter going down. Plan: keep the CSS-drawn .nav-icon in app/globals.css (no markup change) but give the three bars cascading lengths — full / ~¾ / ~½ width, all left-aligned — and make the middle bar a background on the span instead of a box-shadow (box-shadow can't change width). The open-state × animation stays: top/bottom bars grow back to full width and rotate, the middle bar collapses. Will screenshot closed/open at phone width.

Osebotfable-5-150d agothreadide@b5577e0

Done — the phone menu icon now has three left-aligned bars that cascade shorter going down (18 / 13 / 8px), like the reference.

What changed (app/globals.css only, inside the ≤560px block; no markup change in components/site-nav.tsx):

  • Top bar = ::before (18px), bottom bar = ::after (8px).
  • The middle bar used to be a box-shadow on ::before, which can't have its own length, so it's now a background-image (linear-gradient(currentColor, currentColor), 13×2px) on the .nav-icon span itself.
  • Open state is unchanged visually: the middle bar collapses (background-size: 0 2px), the outer bars grow back to 18px and rotate into the ×. Width/top/bottom are transitioned so the morph is still smooth.

Verified with a static mockup of header.top against the real stylesheet at 390px / 3× DPR (screenshot attached: closed and open). Branch thread/df32e3f2 is pushed; no PR opened yet — say the word if you want one.

Note for anyone tweaking this later: the bar lengths are the three literal widths (18px on ::before, 13px in the .nav-icon background-size, 8px on ::after) — the aria-expanded="true" rules reset the outer two to 18px so the × stays symmetric.

New phone menu icon: cascading 18/13/8px bars when closed, × when open (static mockup of header.top with real globals.css, 3× DPR)
New phone menu icon: cascading 18/13/8px bars when closed, × when open (static mockup of header.top with real globals.css, 3× DPR)
Diff · 1 files
diff --git a/threadide/app/globals.css b/threadide/app/globals.css
index ce10a78..cea70ee 100644
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -162,16 +162,24 @@ header.top h1 a { color: var(--text); }
     width: 36px; height: 36px; padding: 0; margin-left: -6px;
     background: none; color: var(--text); line-height: 0; border-radius: 3px; opacity: 1;
   }
-  /* Hamburger drawn with borders instead of the ☰ glyph so it centres exactly on the title regardless of font. */
-  .nav-icon { position: relative; display: block; width: 18px; height: 14px; }
+  /* Hamburger drawn in CSS instead of the ☰ glyph so it centres exactly on the title regardless of font.
+     Three left-aligned bars that cascade shorter (18 / 13 / 8px): top = ::before, bottom = ::after, and the
+     middle bar is the span's own background-image (a box-shadow couldn't have its own width). */
+  .nav-icon {
+    position: relative; display: block; width: 18px; height: 14px;
+    background: linear-gradient(currentColor, currentColor) left 50% / 13px 2px no-repeat;
+    transition: background-size .15s ease;
+  }
   .nav-icon::before, .nav-icon::after {
-    content: ""; position: absolute; left: 0; width: 18px; height: 2px; border-radius: 1px;
-    background: currentColor; transition: transform .15s ease, box-shadow .15s ease;
+    content: ""; position: absolute; left: 0; height: 2px; border-radius: 1px;
+    background: currentColor; transition: transform .15s ease, width .15s ease, top .15s ease, bottom .15s ease;
   }
-  .nav-icon::before { top: 0; box-shadow: 0 6px 0 currentColor; } /* top bar + middle bar */
-  .nav-icon::after { bottom: 0; }
-  .nav-toggle[aria-expanded="true"] .nav-icon::before { top: 6px; box-shadow: none; transform: rotate(45deg); }
-  .nav-toggle[aria-expanded="true"] .nav-icon::after { bottom: 6px; transform: rotate(-45deg); }
+  .nav-icon::before { top: 0; width: 18px; }
+  .nav-icon::after { bottom: 0; width: 8px; }
+  /* Open: middle bar collapses, outer bars grow back to full width and cross into an ×. */
+  .nav-toggle[aria-expanded="true"] .nav-icon { background-size: 0 2px; }
+  .nav-toggle[aria-expanded="true"] .nav-icon::before { top: 6px; width: 18px; transform: rotate(45deg); }
+  .nav-toggle[aria-expanded="true"] .nav-icon::after { bottom: 6px; width: 18px; transform: rotate(-45deg); }
   button.nav-toggle:hover:not(:disabled), button.nav-toggle:active { background: none; opacity: 1; }
   button.nav-toggle:focus-visible { background: rgba(128,128,128,.18); outline: none; }
   /* Hover tint only where a real pointer exists; on touch screens :hover would stick after the tap. */