Add central layout.tsx for /learn/* and /parent/* routes
Next.js route-level layouts provide Sidebar + gradient background automatically for all sub-pages. Individual pages no longer need their own wrapper divs or Sidebar imports. - learn/layout.tsx: Sidebar + purple gradient for all learning pages - parent/layout.tsx: Same for all parent portal pages - LearnLayout.tsx: Reusable component for other pages - Fixed broken <LearnLayout>}> artifacts from previous refactoring - Removed duplicate Sidebar/wrapper code from 9 sub-pages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
28
studio-v2/app/learn/layout.tsx
Normal file
28
studio-v2/app/learn/layout.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client'
|
||||
|
||||
import { Sidebar } from '@/components/Sidebar'
|
||||
import { useTheme } from '@/lib/ThemeContext'
|
||||
|
||||
/**
|
||||
* Shared layout for ALL /learn/* pages.
|
||||
* Provides: Sidebar + gradient background + flex container.
|
||||
* Individual pages only need to render their content.
|
||||
*/
|
||||
export default function LearnLayout({ children }: { children: React.ReactNode }) {
|
||||
const { isDark } = useTheme()
|
||||
|
||||
return (
|
||||
<div className={`min-h-screen flex relative overflow-hidden ${
|
||||
isDark
|
||||
? 'bg-gradient-to-br from-indigo-900 via-purple-900 to-pink-800'
|
||||
: 'bg-gradient-to-br from-slate-100 via-blue-50 to-cyan-100'
|
||||
}`}>
|
||||
<div className="relative z-10 p-4 flex-shrink-0">
|
||||
<Sidebar />
|
||||
</div>
|
||||
<div className="flex-1 flex flex-col relative z-10 overflow-y-auto">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user