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:
Benjamin Admin
2026-04-26 20:44:40 +02:00
parent 3619ddfdad
commit 6210ceb05e
13 changed files with 99 additions and 11 deletions

View 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>
)
}