forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArticleInlineLayout.tsx
67 lines (62 loc) · 1.79 KB
/
ArticleInlineLayout.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
59
60
61
62
63
64
65
66
67
import React from 'react'
import cx from 'classnames'
import { Box } from '@primer/react'
import { SupportPortalVaIframe, SupportPortalVaIframeProps } from './SupportPortalVaIframe'
import styles from './ArticleInlineLayout.module.scss'
type Props = {
breadcrumbs?: React.ReactNode
intro?: React.ReactNode
topper?: React.ReactNode
toc?: React.ReactNode
children?: React.ReactNode
className?: string
supportPortalVaIframeProps?: SupportPortalVaIframeProps
}
export const ArticleInlineLayout = ({
breadcrumbs,
intro,
topper,
toc,
children,
className,
supportPortalVaIframeProps,
}: Props) => {
return (
<Box className={cx(styles.containerBox, className)}>
{breadcrumbs && (
<Box gridArea="breadcrumbs" className={cx('d-none d-xxl-block mt-3 mr-auto width-full')}>
{breadcrumbs}
</Box>
)}
<Box className={cx(styles.contentBox)}>
{topper && <Box gridArea="topper">{topper}</Box>}
{intro && (
<Box id="article-intro" gridArea="intro">
{intro}
</Box>
)}
{toc && (
<Box
gridArea="sidebar"
alignSelf="flex-start"
className={cx(styles.sidebarBox, 'border-bottom border-lg-0 pb-4 mb-5 pb-xl-0 mb-xl-0')}
>
{toc}
</Box>
)}
<Box
gridArea="content"
data-search="article-body"
className={cx(styles.articleContainer, className)}
>
{supportPortalVaIframeProps &&
supportPortalVaIframeProps.supportPortalUrl &&
supportPortalVaIframeProps.vaFlowUrlParameter && (
<SupportPortalVaIframe supportPortalVaIframeProps={supportPortalVaIframeProps} />
)}
{children}
</Box>
</Box>
</Box>
)
}