import type { ReactNode } from "react" import { SHOW_COPY_PLACEHOLDERS } from "./placeholder" import { str, type Section } from "./types" interface SectionBandProps { section: Section /** Whether the section body produced any content. */ hasContent: boolean /** Whether this band takes the soft background in the page's zebra stripe. */ tinted: boolean children: ReactNode } /** * Shell for a marketing band: the `
` wrapper, its heading and its * subtitle. Renders nothing at all when the section has neither content nor a * heading, so an unfilled page degrades to just its hero. * * `rp-not-doc` opts the band out of the doc typography, which applies to * everything inside `.rp-doc` and would otherwise restyle our headings and * paragraphs. It is inert for bands rendered outside the article, as on the * home page. */ export function SectionBand({ section, hasContent, tinted, children }: SectionBandProps) { const title = str(section.title) const subtitle = str(section.subtitle) const className = `rp-site-section rp-not-doc${tinted ? " rp-site-section--tinted" : ""}` if (!hasContent && !title && !subtitle) { if (!SHOW_COPY_PLACEHOLDERS) return null return (
TODO: {section.type}
) } return (
{(title || subtitle) && (
{title &&

{title}

} {subtitle && (

{subtitle}

)}
)} {children}
) }