forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomatedPage.tsx
58 lines (52 loc) · 1.94 KB
/
AutomatedPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { DefaultLayout } from 'components/DefaultLayout'
import { ArticleTitle } from 'components/article/ArticleTitle'
import { MarkdownContent } from 'components/ui/MarkdownContent'
import { Lead } from 'components/ui/Lead'
import { PermissionsStatement } from 'components/ui/PermissionsStatement'
import { ArticleGridLayout } from './ArticleGridLayout'
import { MiniTocs } from 'components/ui/MiniTocs'
import { useAutomatedPageContext } from 'components/context/AutomatedPageContext'
import { ClientSideHighlight } from 'components/ClientSideHighlight'
import { Callout } from 'components/ui/Callout'
type Props = {
children: React.ReactNode
}
export const AutomatedPage = ({ children }: Props) => {
const { title, intro, renderedPage, miniTocItems, product, permissions } =
useAutomatedPageContext()
return (
<DefaultLayout>
<ClientSideHighlight />
<div className="container-xl px-3 px-md-6 my-4">
<ArticleGridLayout
topper={<ArticleTitle>{title}</ArticleTitle>}
intro={
<>
{intro && (
<Lead data-testid="lead" data-search="lead">
{intro}
</Lead>
)}
{permissions && <PermissionsStatement permissions={permissions} />}
{product && (
<Callout
variant="success"
className="mb-4"
dangerouslySetInnerHTML={{ __html: product }}
/>
)}
</>
}
toc={miniTocItems.length > 1 && <MiniTocs miniTocItems={miniTocItems} />}
>
<div id="article-contents">
{renderedPage && (
<MarkdownContent className="pt-3 pb-4">{renderedPage}</MarkdownContent>
)}
{children && <MarkdownContent className="pt-3 pb-4">{children}</MarkdownContent>}
</div>
</ArticleGridLayout>
</div>
</DefaultLayout>
)
}