* Package updates * Fix up things that look broken * Add to utils * Lead now just sets font size, just use f3 where needed * Update package-lock.json * Update index.tsx * Delete bump-link.scss * Update trigger-error.js * Update components/GenericError.tsx Co-authored-by: Ash Guillaume <10384315+ashygee@users.noreply.github.com> * Update ArticlePage.tsx * Update ActionBar.tsx * Changes from meeting * Found a few more monos * Fix from a merge conflict * Missed a few f3s * Update SubLandingHero.tsx * Bye gradients * Match up breadcrumbs * Update SubLandingHero.tsx * Update lists.scss Co-authored-by: Ash Guillaume <10384315+ashygee@users.noreply.github.com>
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="btn btn-outline p-2 outline-none">
|
|
<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>
|
|
)
|
|
}
|