|
|
|
@ -26,6 +26,7 @@ interface Props { |
|
|
|
|
children: ReactNode; |
|
|
|
|
pageTitle: string; |
|
|
|
|
link: Link; |
|
|
|
|
numberedSections?: boolean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function OrganizedContent({ |
|
|
|
@ -34,6 +35,7 @@ export function OrganizedContent({ |
|
|
|
|
children, |
|
|
|
|
pageTitle, |
|
|
|
|
link: Link, |
|
|
|
|
numberedSections = false, |
|
|
|
|
}: Props) { |
|
|
|
|
const [mobileNavOpen, setMobileNavOpen] = useState(false); |
|
|
|
|
const currentIndex = sections.findIndex( |
|
|
|
@ -71,6 +73,7 @@ export function OrganizedContent({ |
|
|
|
|
currentIndex={currentIndex} |
|
|
|
|
link={Link} |
|
|
|
|
pageTitle={pageTitle} |
|
|
|
|
numberedSections={numberedSections} |
|
|
|
|
mobileNavOpen={mobileNavOpen} |
|
|
|
|
setMobileNavOpen={setMobileNavOpen} |
|
|
|
|
/> |
|
|
|
@ -80,7 +83,11 @@ export function OrganizedContent({ |
|
|
|
|
) : ( |
|
|
|
|
<> |
|
|
|
|
<section> |
|
|
|
|
<h1>{section.title}</h1> |
|
|
|
|
<h1> |
|
|
|
|
{numberedSections |
|
|
|
|
? `${currentIndex}. ${section.title}` |
|
|
|
|
: section.title} |
|
|
|
|
</h1> |
|
|
|
|
{children} |
|
|
|
|
</section> |
|
|
|
|
<Footer |
|
|
|
@ -108,6 +115,7 @@ interface NavProps { |
|
|
|
|
currentIndex: number; |
|
|
|
|
link: Link; |
|
|
|
|
pageTitle: string; |
|
|
|
|
numberedSections: boolean; |
|
|
|
|
mobileNavOpen: boolean; |
|
|
|
|
setMobileNavOpen: (mobileNavOpen: boolean) => void; |
|
|
|
|
} |
|
|
|
@ -117,6 +125,7 @@ function Nav({ |
|
|
|
|
currentIndex, |
|
|
|
|
link: Link, |
|
|
|
|
pageTitle, |
|
|
|
|
numberedSections, |
|
|
|
|
mobileNavOpen, |
|
|
|
|
setMobileNavOpen, |
|
|
|
|
}: NavProps) { |
|
|
|
@ -150,7 +159,11 @@ function Nav({ |
|
|
|
|
> |
|
|
|
|
<Link className={classNames.join(" ")} id={section.id}> |
|
|
|
|
<span className={styles.marker} /> |
|
|
|
|
<div>{section.title}</div> |
|
|
|
|
<div> |
|
|
|
|
{numberedSections && section.id !== READ_ALL_ID |
|
|
|
|
? `${index}. ${section.title}` |
|
|
|
|
: section.title} |
|
|
|
|
</div> |
|
|
|
|
</Link> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
@ -221,15 +234,18 @@ export interface SectionWithContent { |
|
|
|
|
|
|
|
|
|
export function createReadAllSection( |
|
|
|
|
sections: Section[], |
|
|
|
|
content: false |
|
|
|
|
content: false, |
|
|
|
|
numberedSections?: undefined |
|
|
|
|
): Section; |
|
|
|
|
export function createReadAllSection( |
|
|
|
|
sections: SectionWithContent[], |
|
|
|
|
content: true |
|
|
|
|
content: true, |
|
|
|
|
numberedSections: boolean |
|
|
|
|
): SectionWithContent; |
|
|
|
|
export function createReadAllSection( |
|
|
|
|
sections: SectionWithContent[] | Section[], |
|
|
|
|
content = true |
|
|
|
|
content = true, |
|
|
|
|
numberedSections?: boolean |
|
|
|
|
): SectionWithContent | Section { |
|
|
|
|
const readAllSection = { |
|
|
|
|
id: READ_ALL_ID, |
|
|
|
@ -243,9 +259,11 @@ export function createReadAllSection( |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{(sections as SectionWithContent[]).map( |
|
|
|
|
({ section: { id, title }, Content }) => ( |
|
|
|
|
({ section: { id, title }, Content }, index) => ( |
|
|
|
|
<section key={id}> |
|
|
|
|
<h1>{title}</h1> |
|
|
|
|
<h1> |
|
|
|
|
{numberedSections ? `${index + 1}. ${title}` : title} |
|
|
|
|
</h1> |
|
|
|
|
<Content /> |
|
|
|
|
</section> |
|
|
|
|
) |
|
|
|
|