Skip to content

ux(sidebar): move the collapse toggle above the profile row + restyle #163

Closed

Description

@gkhngyk

Problem

The sidebar collapse toggle is currently the bottom-most element of the sidebar (below the user-profile row) and styled as a centered icon-only button with its own top border:

web/src/components/layout/sidebar.tsx:181-189

<div className="border-t p-2">
  <Button variant="ghost" size="icon" className="mt-1 w-full" onClick={toggleCollapse}>
    {isCollapsed ? <PanelLeftOpen className="h-4 w-4" /> : <PanelLeftClose className="h-4 w-4" />}
  </Button>
</div>

Two things to clean up:

  1. Position — the profile row is the natural "you are here" footer of the sidebar; the collapse toggle is chrome and should sit above it, not below.
  2. Visual weight — the bordered, full-width, centered icon button reads as a third nav surface rather than a small utility. A left-aligned ghost button with no top border blends in with the rest of the nav stack.

Proposed change

In sidebar.tsx:

  1. Swap the order: collapse-toggle container goes above the user-profile container.
  2. Drop the top border on the collapse-toggle container (border-t p-2 → p-2). The profile row below keeps its border-t, which gives the footer a single visual seam in the right place.
  3. Restyle the button: use the regular ghost variant (not size="icon"), h-9 w-full with justify-start in the expanded state and justify-center only when the sidebar is collapsed. Same height + horizontal rhythm as the nav rows above.
  4. Swap the icons: PanelLeftClose / PanelLeftOpen → ChevronsLeft / ChevronsRight from lucide-react. The chevrons map more directly to "shrink ←" / "expand →" and matches the visual register the user mentioned. Update the import block accordingly.

Reference diff

- import { Crown, Lock, PanelLeftClose, PanelLeftOpen } from 'lucide-react';
+ import { ChevronsLeft, ChevronsRight, Crown, Lock } from 'lucide-react';

-       <div className="border-t p-2">
-         <UserProfileNavItem collapsed={isCollapsed} />
-       </div>
-
-       <div className="border-t p-2">
-         <Button variant="ghost" size="icon" className="mt-1 w-full" onClick={toggleCollapse}>
-           {isCollapsed ? (
-             <PanelLeftOpen className="h-4 w-4" />
-           ) : (
-             <PanelLeftClose className="h-4 w-4" />
-           )}
-         </Button>
-       </div>
+       <div className="p-2">
+         <Button
+           variant="ghost"
+           onClick={toggleCollapse}
+           className={cn(
+             'flex h-9 w-full items-center gap-2 px-2',
+             isCollapsed ? 'justify-center' : 'justify-start',
+           )}
+         >
+           {isCollapsed ? (
+             <ChevronsRight className="h-4 w-4" />
+           ) : (
+             <ChevronsLeft className="h-4 w-4" />
+           )}
+         </Button>
+       </div>
+
+       <div className="border-t p-2">
+         <UserProfileNavItem collapsed={isCollapsed} />
+       </div>

Acceptance criteria

  • Collapse toggle renders above the user-profile row in both expanded and collapsed sidebar states.
  • No top border on the toggle container; profile row still has its border-t.
  • In expanded mode the chevron sits at the left edge of the row; in collapsed mode it stays centered.
  • Clicking the button toggles collapse exactly as before — store action is unchanged.
  • yarn tsc --noEmit and yarn lint clean.

Out of scope

  • Hiding the toggle on mobile / reworking mobile nav.
  • Persisting collapse state anywhere new — keep using the existing sidebar store.
  • Reworking the user-profile row itself.

Activity

  1. added
    enhancement
    good first issue
    on Jun 3, 2026
  2. added a commit that references this issue on Jun 4, 2026
    34e52f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions