webapp/src/components/Views/StaticPage.tsx

37 lines
948 B
TypeScript
Raw Normal View History

import { JSX } from 'solid-js'
2023-11-15 21:51:32 +00:00
import { TableOfContents } from '../TableOfContents'
2024-02-04 11:25:21 +00:00
import { PageLayout } from '../_shared/PageLayout'
2023-11-15 21:51:32 +00:00
type Props = {
2023-11-15 21:51:32 +00:00
title: string
children: JSX.Element
}
export const StaticPage = (props: Props) => {
const articleBodyElement: { current: HTMLElement } = { current: null }
2023-11-15 21:51:32 +00:00
return (
<PageLayout title={props.title}>
<div class="wide-container">
<div class="row">
<article
class="col-md-16 col-lg-14 col-xl-12 offset-md-5"
id="articleBody"
ref={(el) => (articleBodyElement.current = el)}
2023-11-15 21:51:32 +00:00
>
{props.children}
</article>
<div class="col-md-6 offset-md-1">
2023-11-15 21:56:31 +00:00
<TableOfContents
variant="article"
parentSelector="#articleBody"
body={articleBodyElement.current.outerHTML}
2023-11-15 21:56:31 +00:00
/>
2023-11-15 21:51:32 +00:00
</div>
</div>
</div>
</PageLayout>
)
}