teamsync / src /components /chat /ChatShell.tsx
shahzaib24681012's picture
New brand design system: top nav, Hubs & People, accent themes
15106a9
Raw History Blame Contribute Delete
1.89 kB
'use client';
/** Chat screen layout: RoomsPanel (Hubs & People) beside the conversation card. */
import { ReactNode, useState } from 'react';
import { PanelLeft, X } from 'lucide-react';
import RoomsPanel from '../Sidebar';
export default function ChatShell({ children, landing = false }: { children: ReactNode; landing?: boolean }) {
const [drawer, setDrawer] = useState(false);
return (
<div className="flex h-full gap-3 p-2.5 md:p-3.5">
{/* desktop rooms */}
<div className="hidden md:block">
<RoomsPanel />
</div>
{/* mobile: on the landing page show rooms inline; elsewhere a drawer */}
{landing ? (
<div className="block w-full md:hidden">
<RoomsPanel />
</div>
) : (
<>
<button
onClick={() => setDrawer(true)}
className="grad fixed bottom-[84px] left-4 z-30 flex h-11 w-11 items-center justify-center rounded-full text-white shadow-pop md:hidden"
aria-label="Open hubs and people"
>
<PanelLeft className="h-5 w-5" />
</button>
{drawer && (
<div className="fixed inset-0 z-40 md:hidden">
<div className="absolute inset-0 bg-black/40" onClick={() => setDrawer(false)} />
<div className="absolute inset-y-2 left-2 flex" onClick={() => setDrawer(false)}>
<RoomsPanel onNavigate={() => setDrawer(false)} />
</div>
<button onClick={() => setDrawer(false)} className="absolute right-4 top-4 rounded-full bg-white p-2 shadow-pop" aria-label="Close">
<X className="h-4 w-4" />
</button>
</div>
)}
</>
)}
<div className={`panel min-h-0 min-w-0 flex-1 overflow-hidden ${landing ? 'hidden md:block' : ''}`}>
{children}
</div>
</div>
);
}