Skip to content

fix(theme): sidebar drawer through tablet, persistent rail only at xl#61

Merged
mmorerasanchez merged 3 commits into
mainfrom
fix/sidebar-drawer-xl-breakpoint
Jun 2, 2026
Merged

fix(theme): sidebar drawer through tablet, persistent rail only at xl#61
mmorerasanchez merged 3 commits into
mainfrom
fix/sidebar-drawer-xl-breakpoint

Conversation

@mmorerasanchez

@mmorerasanchez mmorerasanchez commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move all sidebar breakpoints from md (768px) / lg (1024px) to xl (1280px) — tablets now get an overlay drawer instead of a cramped persistent rail
  • useIsMobile() updated (MOBILE_BREAKPOINT 768 → 1280) so shadcn's internal drawer/persistent decision aligns with the new boundary
  • All rail-gating Tailwind utilities in sidebar.tsx migrated (md:block, md:flex, inset variants, both hit-area after:md:hidden occurrences, showOnHover opacity)
  • SidebarTrigger visibility changed lg:hiddenxl:hidden; main content padding lg:px-10xl:px-10 so the roomier gutter only kicks in when the rail is present

Breakpoint behaviour after this PR

Width Sidebar Hamburger
< 1280px (mobile, tablet) Overlay drawer Visible
≥ 1280px (desktop) Persistent rail Hidden

Test plan

  • 768px — no rail, hamburger visible, full-width content, no clipping
  • 834px (iPad Pro) — same as above
  • 1024px — same as above
  • 1280px — rail visible, hamburger hidden, content with xl:px-10 padding
  • Drawer opens/closes via hamburger and auto-closes on nav
  • Warm / Dark / Light themes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style
    • Adjusted responsive layout breakpoints for improved display consistency across different screen sizes.
    • Simplified AI customization cards to display essential information only.
    • Updated mobile breakpoint detection for better layout optimization on larger screens.

mmorerasanchez and others added 3 commits June 2, 2026 13:50
…ew cards to ai page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y at xl

Move all sidebar breakpoints from md (768px) / lg (1024px) to xl (1280px)
so the drawer overlay is used on mobile and tablet, and the persistent rail
only appears at true desktop widths (≥1280px).

- use-mobile.tsx: MOBILE_BREAKPOINT 768 → 1280
- sidebar.tsx: all rail-gating md: utilities → xl: (block, flex, inset
  variants, hit-area after:hidden, menu-action opacity-0)
- ShowcaseLayout.tsx: SidebarTrigger lg:hidden → xl:hidden; main
  content lg:px-10 → xl:px-10 so tablet content uses sm:px-6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SidebarMenuAction's after:-inset-2 hit-area expansion was missed in the
md→xl migration because its 8-space indentation didn't match the replace_all
pattern used on SidebarGroupAction (10-space). Both rail handle hit-areas
now consistently hide only at xl (≥1280px), matching the drawer boundary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
democrito Ready Ready Preview, Comment Jun 2, 2026 12:59pm

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR realigns responsive layout breakpoints by raising the mobile detection threshold from 768px to 1280px, then updates sidebar, header, and layout components to use xl: breakpoints instead of md: and lg:. Additionally, it simplifies the Overview page's AI customization cards by removing extra badge and description fields.

Changes

Responsive breakpoint alignment and overview content update

Layer / File(s) Summary
Mobile breakpoint constant update
src/hooks/use-mobile.tsx
MOBILE_BREAKPOINT moves from 768 to 1280, raising the mobile detection threshold for the useIsMobile hook.
Sidebar component responsive styling
src/components/ui/sidebar.tsx
Five locations shift from md: to xl: breakpoints: collapsed wrapper visibility, fixed container layout, inset area styling, group action hit-area, and menu action hover-reveal behavior.
ShowcaseLayout header and main content alignment
src/components/ShowcaseLayout.tsx
Header sidebar trigger and main element padding update from lg:hidden/lg:px-10 to xl:hidden/xl:px-10 to align with sidebar changes.
Overview page AI cards content simplification
src/pages/OverviewPage.tsx
AI customization paths data reduced to to, icon, and name (removing badge and desc); card markup displays only the item name in simplified structure.

Possibly Related PRs

  • mmorerasanchez/democrito#55: Both PRs update src/pages/OverviewPage.tsx's AI paths/card rendering to remove or swap badge/desc fields so the UI only shows simplified label/name content for the Claude/GitHub-related cards.
  • mmorerasanchez/democrito#19: Both PRs modify src/pages/OverviewPage.tsx by changing the data/rendering for the landing page's AI-related customization cards (including removing/simplifying extra per-item fields like badge/desc).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 The viewport shifts one notch wide,
From middle to extra-large screen pride,
Cards trim their ribbons, keep names so neat,
A tidy redesign, responsive and sweet! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: shifting sidebar breakpoint behavior from md/lg to xl, making the sidebar a drawer through tablet sizes and a persistent rail only at xl and above.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sidebar-drawer-xl-breakpoint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/use-mobile.tsx (1)

3-18: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Initialize isMobile from the current media query.

With the breakpoint moved to 1280px, widths 768-1279px now mount in the desktop sidebar path until the effect runs, then flip to the drawer. Seed the state from matchMedia(...).matches and reuse mql.matches in the listener so tablets start in the correct mode.

Suggested fix
 const MOBILE_BREAKPOINT = 1280;
 
 export function useIsMobile() {
-  const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);
+  const getIsMobile = () =>
+    typeof window !== "undefined" &&
+    window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`).matches;
+
+  const [isMobile, setIsMobile] = React.useState(getIsMobile);
 
   React.useEffect(() => {
     const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
-    const onChange = () => {
-      setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+    const onChange = (event: MediaQueryListEvent) => {
+      setIsMobile(event.matches);
     };
     mql.addEventListener("change", onChange);
-    setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+    setIsMobile(mql.matches);
     return () => mql.removeEventListener("change", onChange);
   }, []);
 
-  return !!isMobile;
+  return isMobile;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/use-mobile.tsx` around lines 3 - 18, The useIsMobile hook currently
seeds isMobile from window.innerWidth and uses window.innerWidth in the
listener, causing a flash; change initialization to seed from the media query
(use const mql = window.matchMedia(...); initialize state from mql.matches) and
update the onChange handler to use mql.matches rather than window.innerWidth;
keep MOBILE_BREAKPOINT and the addEventListener/removeEventListener on mql and
still return a boolean from useIsMobile.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/ui/sidebar.tsx`:
- Line 176: The shadcn primitive in Sidebar has app-specific breakpoint classes
(e.g., className="group peer hidden text-sidebar-foreground xl:block" and other
occurrences with "xl:" at the same file) which must be removed; restore the
primitive to baseline by stripping all "xl:" breakpoint utility classes from the
Sidebar primitive JSX (search for the exact class strings like "xl:block" in
this file), then create a composed wrapper component (e.g., SidebarResponsive or
a CVA variant) that imports the original primitive and applies the xl breakpoint
behavior (adds the xl:block/other xl: classes) so app-specific responsiveness
lives outside the ui primitive; update usages to use the new wrapper where the
xl behavior is required.

---

Outside diff comments:
In `@src/hooks/use-mobile.tsx`:
- Around line 3-18: The useIsMobile hook currently seeds isMobile from
window.innerWidth and uses window.innerWidth in the listener, causing a flash;
change initialization to seed from the media query (use const mql =
window.matchMedia(...); initialize state from mql.matches) and update the
onChange handler to use mql.matches rather than window.innerWidth; keep
MOBILE_BREAKPOINT and the addEventListener/removeEventListener on mql and still
return a boolean from useIsMobile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c1270f3-dbe8-443e-8bd6-15ac62cd0e57

📥 Commits

Reviewing files that changed from the base of the PR and between e69a751 and 6a28a4e.

📒 Files selected for processing (4)
  • src/components/ShowcaseLayout.tsx
  • src/components/ui/sidebar.tsx
  • src/hooks/use-mobile.tsx
  • src/pages/OverviewPage.tsx

<div
ref={ref}
className="group peer hidden text-sidebar-foreground md:block"
className="group peer hidden text-sidebar-foreground xl:block"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Keep the xl behavior out of the shadcn primitive.

These breakpoint changes fork src/components/ui/sidebar.tsx for app-specific behavior. Please move them into a wrapper/composed sidebar variant so future shadcn updates stay mergeable.

As per coding guidelines, "Never directly modify src/components/ui/ files (shadcn/ui primitives) — extend them via CVA variants instead. Compose ui/ primitives into atoms/molecules; never rebuild primitives from scratch"

Also applies to: 195-195, 278-278, 386-386, 493-499

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ui/sidebar.tsx` at line 176, The shadcn primitive in Sidebar
has app-specific breakpoint classes (e.g., className="group peer hidden
text-sidebar-foreground xl:block" and other occurrences with "xl:" at the same
file) which must be removed; restore the primitive to baseline by stripping all
"xl:" breakpoint utility classes from the Sidebar primitive JSX (search for the
exact class strings like "xl:block" in this file), then create a composed
wrapper component (e.g., SidebarResponsive or a CVA variant) that imports the
original primitive and applies the xl breakpoint behavior (adds the
xl:block/other xl: classes) so app-specific responsiveness lives outside the ui
primitive; update usages to use the new wrapper where the xl behavior is
required.

@mmorerasanchez mmorerasanchez merged commit 94d8c14 into main Jun 2, 2026
4 checks passed
@mmorerasanchez mmorerasanchez deleted the fix/sidebar-drawer-xl-breakpoint branch June 2, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant