| 1 | import { type ComponentProps, createContext, useContext } from "react"; |
| 2 | |
| 3 | /** True inside the app shell, whose `<main id="content">` already holds the page. */ |
| 4 | export const InMain = createContext(false); |
| 5 | |
| 6 | /** |
| 7 | * A page's main landmark: `<main>` where nothing above is one (signed out), |
| 8 | * a plain `<div>` inside the shell, so a page never has two. |
| 9 | */ |
| 10 | export function PageMain(props: ComponentProps<"main">) { |
| 11 | return useContext(InMain) ? <div {...props} /> : <main {...props} />; |
| 12 | } |