manifold/web/components/page.tsx

44 lines
1.1 KiB
TypeScript
Raw Normal View History

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(
2022-04-04 04:37:14 +00:00
'mx-auto w-full pb-14 lg:grid lg:grid-cols-12 lg:gap-8 lg:pt-6 xl:max-w-7xl',
margin && 'px-4'
)}
>
2022-04-03 21:57:38 +00:00
<div className="hidden lg:col-span-2 lg:block">
<Sidebar />
</div>
<main
className={clsx(
2022-04-03 21:57:38 +00:00
'lg:col-span-8',
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>
)
}