Fix SidebarLayout mobile responsiveness
- Move mobile tabs outside flex container to prevent layout conflict - Add sticky positioning for mobile tabs - Add min-w-0 to main content to prevent overflow - Reduce padding on mobile screens 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,9 +22,31 @@ export default function SidebarLayout({ children, groupKey }: SidebarLayoutProps
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50">
|
<div className="min-h-screen bg-gray-50">
|
||||||
|
{/* Mobile Sidebar - horizontal tabs (outside flex container) */}
|
||||||
|
<div className="md:hidden w-full bg-white border-b shadow-sm sticky top-0 z-10">
|
||||||
|
<div className="flex overflow-x-auto">
|
||||||
|
{group.items.map((item) => {
|
||||||
|
const isActive = pathname === item.path || pathname.startsWith(item.path + '/');
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={item.path}
|
||||||
|
href={item.path}
|
||||||
|
className={`flex-shrink-0 px-4 py-3 text-sm border-b-2 transition whitespace-nowrap ${
|
||||||
|
isActive
|
||||||
|
? 'border-primary-500 text-primary-600 font-medium'
|
||||||
|
: 'border-transparent text-gray-600 hover:text-gray-900'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{getLabel(item.label)}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
{/* Sidebar */}
|
{/* Desktop Sidebar */}
|
||||||
<aside className="w-56 bg-white shadow-md min-h-[calc(100vh-4rem)] hidden md:block">
|
<aside className="w-56 bg-white shadow-md min-h-[calc(100vh-4rem)] hidden md:block flex-shrink-0">
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<h2 className="text-lg font-bold text-gray-800 mb-4 pb-2 border-b">
|
<h2 className="text-lg font-bold text-gray-800 mb-4 pb-2 border-b">
|
||||||
{getLabel(group.label)}
|
{getLabel(group.label)}
|
||||||
@@ -50,30 +72,8 @@ export default function SidebarLayout({ children, groupKey }: SidebarLayoutProps
|
|||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
{/* Mobile Sidebar - horizontal tabs */}
|
|
||||||
<div className="md:hidden w-full bg-white border-b shadow-sm">
|
|
||||||
<div className="flex overflow-x-auto">
|
|
||||||
{group.items.map((item) => {
|
|
||||||
const isActive = pathname === item.path || pathname.startsWith(item.path + '/');
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
key={item.path}
|
|
||||||
href={item.path}
|
|
||||||
className={`flex-shrink-0 px-4 py-3 text-sm border-b-2 transition ${
|
|
||||||
isActive
|
|
||||||
? 'border-primary-500 text-primary-600 font-medium'
|
|
||||||
: 'border-transparent text-gray-600 hover:text-gray-900'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{getLabel(item.label)}
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Main Content */}
|
{/* Main Content */}
|
||||||
<main className="flex-1 p-6">
|
<main className="flex-1 p-3 sm:p-6 min-w-0">
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user