Skip to content

Commit 2e41877

Browse files
rsesemattpollardlecoursen
authored
Add link to versions doc in version picker (github#25012)
* Add link to 'about versions' in version picker * Add translation string * Match article short title * Better text contrast * Key names is 'docs_versions' * 'About versions' * Show version picker when only 1 version Co-authored-by: Matt Pollard <[email protected]> Co-authored-by: Laura Coursen <[email protected]>
1 parent 37c7179 commit 2e41877

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

components/page-header/VersionPicker.tsx

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useRouter } from 'next/router'
2-
import { ArrowRightIcon } from '@primer/octicons-react'
2+
import { ArrowRightIcon, InfoIcon } from '@primer/octicons-react'
33

44
import { Link } from 'components/Link'
55
import { useMainContext } from 'components/context/MainContext'
6-
import { useVersion } from 'components/hooks/useVersion'
6+
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
77
import { useTranslation } from 'components/hooks/useTranslation'
88
import { Picker } from 'components/ui/Picker'
99

@@ -17,7 +17,7 @@ export const VersionPicker = ({ variant }: Props) => {
1717
const { allVersions, page, enterpriseServerVersions } = useMainContext()
1818
const { t } = useTranslation(['pages', 'picker'])
1919

20-
if (page.permalinks && page.permalinks.length <= 1) {
20+
if (page.permalinks && page.permalinks.length < 1) {
2121
return null
2222
}
2323

@@ -37,7 +37,7 @@ export const VersionPicker = ({ variant }: Props) => {
3737
item: (
3838
<Link
3939
href={`/${router.locale}/${enterpriseServerVersions[0]}/admin/all-releases`}
40-
className="f6 no-underline color-fg-muted"
40+
className="f6 no-underline"
4141
>
4242
{t('all_enterprise_releases')}{' '}
4343
<ArrowRightIcon verticalAlign="middle" size={15} className="mr-2" />
@@ -46,6 +46,23 @@ export const VersionPicker = ({ variant }: Props) => {
4646
})
4747
}
4848

49+
if (allLinks) {
50+
const currentVersionPathSegment = currentVersion === DEFAULT_VERSION ? '' : `/${currentVersion}`
51+
52+
allLinks.push({
53+
text: t('docs_versions'),
54+
selected: false,
55+
item: (
56+
<Link
57+
href={`/${router.locale}${currentVersionPathSegment}/get-started/learning-about-github/about-versions-of-github-docs`}
58+
className="f6 no-underline"
59+
>
60+
{t('about_versions')} <InfoIcon verticalAlign="middle" size={15} className="mr-2" />
61+
</Link>
62+
),
63+
})
64+
}
65+
4966
return (
5067
<Picker
5168
variant={variant}

data/ui.yml

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pages:
5454
miniToc: In this article
5555
contributor_callout: This article is contributed and maintained by
5656
all_enterprise_releases: All Enterprise Server releases
57+
about_versions: About versions
5758
errors:
5859
oops: Ooops!
5960
something_went_wrong: It looks like something went wrong.

0 commit comments

Comments
 (0)