Add PageShell — collapsed sidebar strip on Dashboard and all admin pages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de49df70b0
commit
b3c02adf76
7 changed files with 75 additions and 34 deletions
57
src/components/PageShell.tsx
Normal file
57
src/components/PageShell.tsx
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { useState } from 'react'
|
||||
import { ChevronRight } from 'lucide-react'
|
||||
import { Sidebar } from './Sidebar'
|
||||
import type { User } from '../types'
|
||||
|
||||
interface Props {
|
||||
user: User
|
||||
children: React.ReactNode
|
||||
padding?: string
|
||||
}
|
||||
|
||||
export function PageShell({ user, children, padding = '1.5rem 2rem' }: Props) {
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', height: '100dvh' }}>
|
||||
|
||||
{/* Collapsed sidebar strip */}
|
||||
<div style={{
|
||||
width: 44, flexShrink: 0,
|
||||
background: 'var(--navy)', borderRight: '1px solid var(--surface-2)',
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
height: '100dvh', position: 'sticky', top: 0,
|
||||
}}>
|
||||
<button
|
||||
onClick={() => setMenuOpen(true)}
|
||||
title="Open menu"
|
||||
style={{
|
||||
background: 'none', border: 'none', cursor: 'pointer',
|
||||
color: 'var(--text-muted)', padding: '0.5rem',
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
borderRadius: 6,
|
||||
}}
|
||||
>
|
||||
<ChevronRight size={18} strokeWidth={1.75} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Overlay sidebar + backdrop when open */}
|
||||
{menuOpen && (
|
||||
<>
|
||||
<div
|
||||
onClick={() => setMenuOpen(false)}
|
||||
style={{ position: 'fixed', inset: 0, zIndex: 19, background: 'rgba(0,0,0,0.35)' }}
|
||||
/>
|
||||
<div style={{ position: 'fixed', left: 0, top: 0, height: '100dvh', zIndex: 20 }}>
|
||||
<Sidebar user={user} onCollapse={() => setMenuOpen(false)} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<main style={{ flex: 1, overflowY: 'auto', padding }}>
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue