* cleanup FEATURE_NEXTJS * fixing some server tests * updating article a for server tests * update h2 to h4 map topic tests * data off on TOCs * updating dropdown article versions links * Update so markdown renders in intros * updating typo and all server tests are now passing * remove nextjs feature flag * head.js tests pass * updating article-version-picker * remove nextjs feature flag browser test * update header.js tests * fix page-titles.js test * fix deprecated-enterprise versions * adding early access * testing * getting childTocItem * fixing table of contents to show child toc items * updated to 2 because the sidebar article also has the same link * remove comment * updating pick * Update TocLandingContext.tsx * update package.json and change className to h4 for h2 * updating with mikes feedback * remove a.active test * React clean up: Delete unnecessary layouts/includes Part 2 (#20143) * Delete unnecessary layouts * setting back tests failing :( * update layouts * delete unnecessary includes * remove github-ae-release-notes and updating layouts * remove a.active test
157 lines
5.4 KiB
TypeScript
157 lines
5.4 KiB
TypeScript
import cx from 'classnames'
|
|
|
|
import { DefaultLayout } from 'components/DefaultLayout'
|
|
import { ArticleVersionPicker } from 'components/article/ArticleVersionPicker'
|
|
import { Breadcrumbs } from 'components/Breadcrumbs'
|
|
import { ArticleTitle } from 'components/article/ArticleTitle'
|
|
import { useArticleContext } from 'components/context/ArticleContext'
|
|
import { InfoIcon } from '@primer/octicons-react'
|
|
import { useTranslation } from 'components/hooks/useTranslation'
|
|
import { LearningTrackNav } from './LearningTrackNav'
|
|
|
|
export const ArticlePage = () => {
|
|
const {
|
|
title,
|
|
intro,
|
|
renderedPage,
|
|
contributor,
|
|
permissions,
|
|
includesPlatformSpecificContent,
|
|
defaultPlatform,
|
|
product,
|
|
miniTocItems,
|
|
currentLearningTrack,
|
|
} = useArticleContext()
|
|
const { t } = useTranslation('pages')
|
|
return (
|
|
<DefaultLayout>
|
|
<div className="container-xl px-3 px-md-6 my-4 my-lg-4">
|
|
<article className="markdown-body">
|
|
<div className="d-lg-flex flex-justify-between">
|
|
<div className="d-block d-lg-none">
|
|
<ArticleVersionPicker />
|
|
</div>
|
|
<div className="d-flex flex-items-center">
|
|
<Breadcrumbs />
|
|
</div>
|
|
<div className="d-none d-lg-block">
|
|
<ArticleVersionPicker />
|
|
</div>
|
|
</div>
|
|
|
|
<div className="article-grid-container mt-2">
|
|
<div className="article-grid-head">
|
|
<ArticleTitle>{title}</ArticleTitle>
|
|
|
|
{contributor && (
|
|
<div className="contributor-callout border rounded-1 mb-4 p-3 color-border-info color-bg-info f5">
|
|
<p>
|
|
<span className="mr-2">
|
|
<InfoIcon />
|
|
</span>
|
|
{t('contributor_callout')} <a href={contributor.URL}>{contributor.name}</a>.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{intro && (
|
|
<div
|
|
className="lead-mktg"
|
|
dangerouslySetInnerHTML={{ __html: intro }}
|
|
/>
|
|
)}
|
|
|
|
{permissions && (
|
|
<div
|
|
className="permissions-statement"
|
|
dangerouslySetInnerHTML={{ __html: permissions }}
|
|
/>
|
|
)}
|
|
|
|
{includesPlatformSpecificContent && (
|
|
<nav
|
|
className="UnderlineNav my-3"
|
|
data-default-platform={defaultPlatform || undefined}
|
|
>
|
|
<div className="UnderlineNav-body">
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
<a href="#" className="UnderlineNav-item platform-switcher" data-platform="mac">
|
|
Mac
|
|
</a>
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
<a
|
|
href="#"
|
|
className="UnderlineNav-item platform-switcher"
|
|
data-platform="windows"
|
|
>
|
|
Windows
|
|
</a>
|
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
<a
|
|
href="#"
|
|
className="UnderlineNav-item platform-switcher"
|
|
data-platform="linux"
|
|
>
|
|
Linux
|
|
</a>
|
|
</div>
|
|
</nav>
|
|
)}
|
|
|
|
{product && (
|
|
<div
|
|
className="product-callout border rounded-1 mb-4 p-3 color-border-success color-bg-success"
|
|
dangerouslySetInnerHTML={{ __html: product }}
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
<div className="article-grid-toc border-bottom border-xl-0 pb-4 mb-5 pb-xl-0 mb-xl-0">
|
|
<div className="article-grid-toc-content">
|
|
{miniTocItems.length > 1 && (
|
|
<>
|
|
<h2 id="in-this-article" className="f5 mb-2">
|
|
<a className="Link--primary" href="#in-this-article">
|
|
{t('miniToc')}
|
|
</a>
|
|
</h2>
|
|
<ul className="list-style-none pl-0 f5 mb-0">
|
|
{miniTocItems.map((item) => {
|
|
return (
|
|
<li
|
|
key={item.contents}
|
|
className={cx(
|
|
`ml-${item.indentationLevel * 3}`,
|
|
item.platform,
|
|
'mb-2 lh-condensed'
|
|
)}
|
|
dangerouslySetInnerHTML={{ __html: item.contents }}
|
|
/>
|
|
)
|
|
})}
|
|
</ul>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="markdown-body">
|
|
<div
|
|
id="article-contents"
|
|
className="article-grid-body"
|
|
dangerouslySetInnerHTML={{ __html: renderedPage }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
{currentLearningTrack?.trackName ? (
|
|
<div className="d-block mt-4 markdown-body">
|
|
<LearningTrackNav track={currentLearningTrack} />
|
|
</div>
|
|
) : null}
|
|
</article>
|
|
</div>
|
|
</DefaultLayout>
|
|
)
|
|
}
|