manifold/web/components/page.tsx
Austin Chen 75e48204ef
Add left sidebar (with mobile support this time) (#71)
* Revert "Reverting side navbar for now"

This reverts commit a90441d9d5.

* Use padding instead of margin for bg color

* Use a slideout menu on mobile

* Remove "wide" page option

* Stick right sidebar on page bottom

* Darken bg on hover
2022-03-30 22:35:20 -07:00

44 lines
1.2 KiB
TypeScript

import clsx from 'clsx'
import { BottomNavBar } from './nav/nav-bar'
import Sidebar from './nav/sidebar'
export function Page(props: {
margin?: boolean
assertUser?: 'signed-in' | 'signed-out'
rightSidebar?: React.ReactNode
children?: any
}) {
const { margin, assertUser, children, rightSidebar } = props
return (
<div>
<div
className={clsx(
'mx-auto w-full pb-16 lg:grid lg:grid-cols-12 lg:gap-8 xl:max-w-7xl',
margin && 'px-4'
)}
>
<div className="hidden lg:col-span-3 lg:block xl:col-span-2">
{assertUser !== 'signed-out' && <Sidebar />}
</div>
<main
className={clsx(
'pt-6 lg:col-span-9',
rightSidebar ? 'xl:col-span-7' : 'xl:col-span-8'
)}
>
{children}
{/* If right sidebar is hidden, place its content at the bottom of the page. */}
<div className="block xl:hidden">{rightSidebar}</div>
</main>
<aside className="hidden xl:col-span-3 xl:block">
<div className="sticky top-4 space-y-4">{rightSidebar}</div>
</aside>
</div>
<BottomNavBar />
</div>
)
}