generated from michellepace/nextjs-base
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add responsive left sidebar navigation #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8358947
chore: add dummy content to test future sidebar/rail scroll
michellepace 4aeef3e
feat: add responsive left sidebar navigation
michellepace 2b6a58d
feat: add expand/collapse toggle to left sidebar
michellepace e94df00
refactor: fix rail mode alignment and add responsive sidebar default
michellepace 176e869
test: coderabbit | add early validation for E2E test credentials
michellepace 73f313a
chore: coderabbit | update dependencies to latest versions
michellepace be08e45
test: centralise viewport definitions and restore WebKit coverage
michellepace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| "use client"; | ||
|
|
||
| import { SignedIn, UserButton } from "@clerk/nextjs"; | ||
| import { NavLink } from "@/components/navigation/nav-link"; | ||
| import { NAV_LINKS } from "@/components/navigation/nav-links.constants"; | ||
| import { SidebarToggle } from "@/components/navigation/sidebar-toggle"; | ||
| import { useSidebar } from "@/components/sidebar-provider"; | ||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| // Navbar height minus overlap to hide shadow-sm | ||
| const SIDEBAR_TOP_OFFSET = 72; // 73px navbar - 1px overlap | ||
|
|
||
| export function LeftSidebar() { | ||
| const { isCollapsed } = useSidebar(); | ||
|
|
||
| return ( | ||
| <aside | ||
| style={{ | ||
| top: SIDEBAR_TOP_OFFSET, | ||
| height: `calc(100vh - ${SIDEBAR_TOP_OFFSET}px)`, | ||
| }} | ||
| className={cn( | ||
| "sticky z-50 hidden flex-col justify-between overflow-y-auto border-r border-sidebar-border bg-sidebar p-4 transition-[width] duration-500 ease-in-out sm:flex", | ||
| isCollapsed ? "w-16" : "w-56", | ||
| )} | ||
| > | ||
| {/* Top: Navigation Links */} | ||
| <nav | ||
| className={cn("flex flex-col gap-3", isCollapsed && "items-center")} | ||
| aria-label="Main navigation" | ||
| > | ||
| {NAV_LINKS.map((link) => ( | ||
| <NavLink | ||
| key={link.route} | ||
| imgURL={link.imgURL} | ||
| route={link.route} | ||
| label={link.label} | ||
| variant="rail" | ||
| /> | ||
| ))} | ||
| </nav> | ||
|
|
||
| {/* Bottom: User Avatar + Toggle */} | ||
| <div | ||
| className={cn( | ||
| "flex items-center gap-2", | ||
| // Collapsed: vertical stack (UserButton above, toggle below) | ||
| // Expanded: horizontal row (UserButton left, toggle right) | ||
| isCollapsed ? "flex-col" : "justify-between", | ||
| )} | ||
| > | ||
| <SignedIn> | ||
| <UserButton /> | ||
| </SignedIn> | ||
| <SidebarToggle /> | ||
| </div> | ||
| </aside> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
LGTM! Enforcing consistent type definitions.
The addition of the
useConsistentTypeDefinitionsrule with"style": "type"is appropriate and aligns with the broader PR objective to standardise TypeScript type definitions across the codebase. Setting the level to "error" ensures consistent enforcement.Note: This rule enforces
typealiases overinterfacedeclarations. Whilst both are valid TypeScript constructs,typeoffers more flexibility for unions, intersections, and primitives. This is a sound stylistic choice for consistency.🤖 Prompt for AI Agents