diff --git a/components/article/ArticleInlineLayout.module.scss b/components/article/ArticleInlineLayout.module.scss new file mode 100644 index 0000000000..c65fe6aabc --- /dev/null +++ b/components/article/ArticleInlineLayout.module.scss @@ -0,0 +1,30 @@ +.containerBox { + padding-top: 24px; + max-width: 720px; + margin: 0 auto; + align-content: center; + column-gap: 80px; + row-gap: 0; + grid-template-areas: + "topper" + "intro" + "sidebar" + "content"; + grid-template-rows: auto 1fr; + grid-template-columns: minmax(300px, 720px); + display: grid; + + @media (min-width: 720px) { + display: grid; + justify-items: flex-start; + justify-content: center; + } +} + +.sidebarBox { + width: 100%; +} + +.articleContainer { + max-width: 720px; +} diff --git a/components/article/ArticleInlineLayout.tsx b/components/article/ArticleInlineLayout.tsx new file mode 100644 index 0000000000..d8e02f87ed --- /dev/null +++ b/components/article/ArticleInlineLayout.tsx @@ -0,0 +1,57 @@ +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 = { + intro?: React.ReactNode + topper?: React.ReactNode + toc?: React.ReactNode + children?: React.ReactNode + className?: string + supportPortalVaIframeProps?: SupportPortalVaIframeProps +} +export const ArticleInlineLayout = ({ + intro, + topper, + toc, + children, + className, + supportPortalVaIframeProps, +}: Props) => { + return ( + + {topper && {topper}} + {toc && ( + + {toc} + + )} + + {intro && ( + + {intro} + + )} + + + {supportPortalVaIframeProps && + supportPortalVaIframeProps.supportPortalUrl && + supportPortalVaIframeProps.vaFlowUrlParameter && ( + + )} + {children} + + + ) +} diff --git a/components/article/ArticlePage.tsx b/components/article/ArticlePage.tsx index f007f7ef32..fbc12de317 100644 --- a/components/article/ArticlePage.tsx +++ b/components/article/ArticlePage.tsx @@ -12,6 +12,7 @@ import { MarkdownContent } from 'components/ui/MarkdownContent' import { Lead } from 'components/ui/Lead' import { PermissionsStatement } from 'components/ui/PermissionsStatement' import { ArticleGridLayout } from './ArticleGridLayout' +import { ArticleInlineLayout } from './ArticleInlineLayout' import { PlatformPicker } from 'components/article/PlatformPicker' import { ToolPicker } from 'components/article/ToolPicker' import { MiniTocs } from 'components/ui/MiniTocs' @@ -42,10 +43,62 @@ export const ArticlePage = () => { miniTocItems, currentLearningTrack, supportPortalVaIframeProps, + currentLayout, } = useArticleContext() const isLearningPath = !!currentLearningTrack?.trackName const { t } = useTranslation(['pages']) + const introProp = ( + <> + {intro && ( + // Note the `_page-intro` is used by the popover preview cards + // when it needs this text for in-page links. + + {intro} + + )} + + {permissions && } + + {includesPlatformSpecificContent && } + {includesToolSpecificContent && } + + {product && ( + + )} + + ) + + const toc = ( + <> + {isLearningPath && } + {miniTocItems.length > 1 && } + + ) + + const articleContents = ( +
+ {productVideoUrl && ( +
+ + + {t('video_from_transcript')} + +
+ )} + + {renderedPage} + {effectiveDate && ( +
+ Effective as of:{' '} + +
+ )} +
+ ) + return ( @@ -55,61 +108,25 @@ export const ArticlePage = () => {
- {title}} - intro={ - <> - {intro && ( - // Note the `_page-intro` is used by the popover preview cards - // when it needs this text for in-page links. - - {intro} - - )} - - {permissions && } - - {includesPlatformSpecificContent && } - {includesToolSpecificContent && } - - {product && ( - - )} - - } - toc={ - <> - {isLearningPath && } - {miniTocItems.length > 1 && } - - } - > -
- {productVideoUrl && ( -
- - - {t('video_from_transcript')} - -
- )} - - {renderedPage} - {effectiveDate && ( -
- Effective as of:{' '} - -
- )} -
-
+ {currentLayout === 'inline' ? ( + {title}} + intro={introProp} + toc={toc} + > + {articleContents} + + ) : ( + {title}} + intro={introProp} + toc={toc} + > + {articleContents} + + )} {isLearningPath ? (
diff --git a/components/context/ArticleContext.tsx b/components/context/ArticleContext.tsx index 83de5be204..19d53b5600 100644 --- a/components/context/ArticleContext.tsx +++ b/components/context/ArticleContext.tsx @@ -38,6 +38,7 @@ export type ArticleContextT = { detectedTools: Array allTools: Record supportPortalVaIframeProps: SupportPortalVaIframeProps + currentLayout?: string } export const ArticleContext = createContext(null) @@ -99,5 +100,6 @@ export const getArticleContextFromRequest = (req: any): ArticleContextT => { detectedTools: page.detectedTools || [], allTools: page.allToolsParsed || [], // this is set at the page level, see lib/page.js supportPortalVaIframeProps, + currentLayout: req.context.currentLayoutName, } }