| 1 | import type { ComponentPropsWithoutRef } from "react"; |
| 2 | |
| 3 | import { cn } from "../lib/utils"; |
| 4 | |
| 5 | export type WorkspacePageWidth = "readable" | "wide" | "expanded"; |
| 6 | |
| 7 | const WIDTH_CLASS: Record<WorkspacePageWidth, string> = { |
| 8 | readable: "max-w-4xl", |
| 9 | wide: "max-w-5xl", |
| 10 | expanded: "max-w-6xl", |
| 11 | }; |
| 12 | |
| 13 | /** Shared content frame for workspace pages. */ |
| 14 | export function WorkspacePageContainer({ |
| 15 | width = "readable", |
| 16 | className, |
| 17 | ...props |
| 18 | }: ComponentPropsWithoutRef<"div"> & { readonly width?: WorkspacePageWidth }) { |
| 19 | return ( |
| 20 | <div |
| 21 | className={cn( |
| 22 | "mx-auto flex w-full flex-col gap-6 px-5 pt-6 pb-12 sm:px-6", |
| 23 | WIDTH_CLASS[width], |
| 24 | className, |
| 25 | )} |
| 26 | {...props} |
| 27 | /> |
| 28 | ); |
| 29 | } |