* 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
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import { Dropdown } from '@primer/components'
|
|
|
|
import { Link } from 'components/Link'
|
|
import { useMainContext } from 'components/context/MainContext'
|
|
import { useVersion } from 'components/hooks/useVersion'
|
|
import { useTranslation } from 'components/hooks/useTranslation'
|
|
|
|
export const ArticleVersionPicker = () => {
|
|
const router = useRouter()
|
|
const { currentVersion } = useVersion()
|
|
const { allVersions, page, enterpriseServerVersions } = useMainContext()
|
|
const { t } = useTranslation('pages')
|
|
|
|
if (page.permalinks && page.permalinks.length <= 1) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Dropdown
|
|
css={`
|
|
ul {
|
|
width: unset;
|
|
}
|
|
`}
|
|
data-testid="article-version-picker"
|
|
>
|
|
<summary className="f4 h5-mktg btn-outline-mktg btn-mktg p-2">
|
|
<span className="d-md-none d-xl-inline-block">{t('article_version')}</span>{' '}
|
|
{allVersions[currentVersion].versionTitle}
|
|
<Dropdown.Caret />
|
|
</summary>
|
|
<Dropdown.Menu direction="sw">
|
|
{(page.permalinks || []).map((permalink) => {
|
|
return (
|
|
<Dropdown.Item key={permalink.href}>
|
|
<Link href={permalink.href}>{permalink.pageVersionTitle}</Link>
|
|
</Dropdown.Item>
|
|
)
|
|
})}
|
|
<div className="pb-1">
|
|
<Link
|
|
href={`/${router.locale}/${enterpriseServerVersions[0]}/admin/all-releases`}
|
|
className="f6 no-underline color-text-tertiary pl-3 pr-2 no-wrap"
|
|
>
|
|
See all Enterprise releases
|
|
</Link>
|
|
</div>
|
|
</Dropdown.Menu>
|
|
</Dropdown>
|
|
)
|
|
}
|