forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into kh-enable_jsx_a11y_linter
- Loading branch information
Showing
40 changed files
with
1,841 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useState, useEffect, MutableRefObject, RefObject } from 'react' | ||
|
||
export function useOnScreen<T extends Element>( | ||
ref: MutableRefObject<T | undefined> | RefObject<T>, | ||
rootMargin: string = '0px' | ||
): boolean { | ||
const [isIntersecting, setIntersecting] = useState(false) | ||
useEffect(() => { | ||
const observer = new IntersectionObserver( | ||
([entry]) => { | ||
setIntersecting(entry.isIntersecting) | ||
}, | ||
{ | ||
rootMargin, | ||
} | ||
) | ||
if (ref.current) { | ||
observer.observe(ref.current) | ||
} | ||
return () => { | ||
ref.current && observer.unobserve(ref.current) | ||
} | ||
}, []) | ||
return isIntersecting | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { ArrowRightIcon, ArrowUpIcon, FileIcon, ListUnorderedIcon } from '@primer/octicons-react' | ||
import { useMainContext } from 'components/context/MainContext' | ||
import { useProductLandingContext } from 'components/context/ProductLandingContext' | ||
import { useTranslation } from 'components/hooks/useTranslation' | ||
import { Link } from 'components/Link' | ||
import { useRouter } from 'next/router' | ||
|
||
export function ProductReleases() { | ||
const { t } = useTranslation('product_landing') | ||
const router = useRouter() | ||
const { enterpriseServerReleases, allVersions } = useMainContext() | ||
const { releases } = useProductLandingContext() | ||
const currentPath = router.asPath.split('?')[0] | ||
return ( | ||
<div> | ||
<div className="d-lg-flex gutter-lg flex-items-stretch"> | ||
{releases.map((release) => { | ||
const releaseNumber = release.version | ||
if (!enterpriseServerReleases.supported.includes(releaseNumber)) { | ||
return null | ||
} | ||
const releaseVersion = `enterprise-server@${releaseNumber}` | ||
const latestPatch = release.patches[0] | ||
const firstPreviousVersion = `enterprise-server@${release.firstPreviousRelease}` | ||
const secondPreviousVersion = `enterprise-server@${release.secondPreviousRelease}` | ||
return ( | ||
<div key={releaseNumber} className="col-lg-4 col-12 mb-3"> | ||
<div className="Box color-shadow-medium height-full d-block hover-shadow-large no-underline color-text-primary p-5"> | ||
<h2>{allVersions[releaseVersion].versionTitle}</h2> | ||
<p className="mt-2 mb-4 color-text-tertiary"> | ||
<ListUnorderedIcon />{' '} | ||
<Link | ||
href={`/${router.locale}/${releaseVersion}/admin/release-notes#${latestPatch.version}`} | ||
> | ||
{t('release_notes_for')} {latestPatch.version} | ||
</Link>{' '} | ||
({latestPatch.date}) | ||
</p> | ||
<p className="mt-2 mb-4 color-text-tertiary"> | ||
<ArrowUpIcon /> {t('upgrade_from')}{' '} | ||
<Link | ||
href={`/${router.locale}/${firstPreviousVersion}/admin/enterprise-management/upgrading-github-enterprise-server`} | ||
> | ||
{release.firstPreviousRelease} | ||
</Link>{' '} | ||
or{' '} | ||
<Link | ||
href={`/${router.locale}/${secondPreviousVersion}/admin/enterprise-management/upgrading-github-enterprise-server`} | ||
> | ||
{release.secondPreviousRelease} | ||
</Link> | ||
</p> | ||
<p className="mt-2 mb-4 color-text-tertiary"> | ||
<FileIcon />{' '} | ||
<Link href={`/${router.locale}/${releaseVersion}`}>{t('browse_all_docs')}</Link> | ||
</p> | ||
</div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
|
||
<Link href={`${currentPath}/release-notes}`} className="btn btn-outline float-right"> | ||
{t('explore_release_notes')} <ArrowRightIcon /> | ||
</Link> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { useRef, useEffect } from 'react' | ||
|
||
import { useTranslation } from 'components/hooks/useTranslation' | ||
import { useOnScreen } from 'components/hooks/useOnScreen' | ||
import { PatchNotes } from './PatchNotes' | ||
import { ReleaseNotePatch } from './types' | ||
|
||
type Props = { patch: ReleaseNotePatch; didEnterView: () => void } | ||
export function GHAEReleaseNotePatch({ patch, didEnterView }: Props) { | ||
const { t } = useTranslation('release_notes') | ||
const containerRef = useRef<HTMLDivElement>(null) | ||
const onScreen = useOnScreen(containerRef, '-40% 0px -50%') | ||
useEffect(() => { | ||
if (onScreen) { | ||
didEnterView() | ||
} | ||
}, [onScreen]) | ||
|
||
const bannerText = patch.currentWeek | ||
? t('banner_text_current') | ||
: `${t('banner_text_past')} ${patch.friendlyDate}.` | ||
|
||
return ( | ||
<div | ||
ref={containerRef} | ||
className="mb-10 color-bg-secondary pb-6 border-bottom border-top" | ||
id={patch.date} | ||
> | ||
<header | ||
style={{ zIndex: 1 }} | ||
className="container-xl position-sticky top-0 color-bg-secondary border-bottom px-3 pt-4 pb-2" | ||
> | ||
<div className="d-flex flex-items-center"> | ||
<h2 className="border-bottom-0 m-0 p-0">{patch.title}</h2> | ||
|
||
{patch.release_candidate && ( | ||
<span | ||
className="IssueLabel color-bg-warning-inverse color-text-inverse ml-3" | ||
style={{ whiteSpace: 'pre' }} | ||
> | ||
Release Candidate | ||
</span> | ||
)} | ||
|
||
<button className="js-print btn-link ml-3 text-small text-bold">Print</button> | ||
</div> | ||
<p className="color-text-secondary mt-1"> | ||
{patch.friendlyDate} - {bannerText} | ||
</p> | ||
</header> | ||
|
||
<div className="container-xl px-3"> | ||
<div className="mt-3" dangerouslySetInnerHTML={{ __html: patch.intro }} /> | ||
|
||
<PatchNotes patch={patch} /> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { useState } from 'react' | ||
import cx from 'classnames' | ||
import { ChevronDownIcon } from '@primer/octicons-react' | ||
import { GHAEReleaseNotePatch } from './GHAEReleaseNotePatch' | ||
import { GHAEReleaseNotesContextT } from './types' | ||
|
||
type GitHubAEProps = { | ||
context: GHAEReleaseNotesContextT | ||
} | ||
export function GHAEReleaseNotes({ context }: GitHubAEProps) { | ||
const { releaseNotes, releases, currentVersion } = context | ||
const [focusedPatch, setFocusedPatch] = useState('') | ||
|
||
return ( | ||
<div className="d-flex"> | ||
<article className="min-width-0 flex-1"> | ||
<div className="d-flex flex-items-center flex-justify-between color-bg-primary px-5 py-2"> | ||
<div></div> | ||
<h1 className="f4 py-3 m-0">{currentVersion.planTitle} release notes</h1> | ||
<div></div> | ||
</div> | ||
|
||
<div className="markdown-body"> | ||
{releaseNotes.map((patch) => { | ||
return ( | ||
<GHAEReleaseNotePatch | ||
key={patch.version} | ||
patch={patch} | ||
didEnterView={() => setFocusedPatch(patch.version)} | ||
/> | ||
) | ||
})} | ||
</div> | ||
</article> | ||
|
||
<aside | ||
className="markdown-body position-sticky top-0 d-none d-md-block border-left no-print color-bg-primary flex-shrink-0" | ||
style={{ width: 260, height: '100vh' }} | ||
> | ||
<nav className="height-full overflow-auto"> | ||
<ul className="list-style-none pl-0 text-bold"> | ||
{releases.map((release) => { | ||
return ( | ||
<li key={release.version} className="border-bottom"> | ||
<details | ||
className="my-0 details-reset release-notes-version-picker" | ||
aria-current="page" | ||
open | ||
> | ||
<summary className="px-3 py-4 my-0 d-flex flex-items-center flex-justify-between"> | ||
{release.version} | ||
<div className="d-flex"> | ||
<span className="color-text-tertiary text-mono text-small text-normal mr-1"> | ||
{release.patches.length} releases | ||
</span> | ||
<ChevronDownIcon /> | ||
</div> | ||
</summary> | ||
<ul className="color-bg-tertiary border-top list-style-none py-4 px-0 my-0"> | ||
{release.patches.map((patch) => { | ||
const isActive = patch.version === focusedPatch | ||
return ( | ||
<li | ||
key={patch.version} | ||
className={cx( | ||
'js-release-notes-patch-link px-3 my-0 py-1', | ||
isActive && 'selected' | ||
)} | ||
> | ||
<a | ||
href={`#${patch.date}`} | ||
className="d-flex flex-items-center flex-justify-between" | ||
> | ||
{patch.friendlyDate} | ||
</a> | ||
</li> | ||
) | ||
})} | ||
</ul> | ||
</details> | ||
</li> | ||
) | ||
})} | ||
</ul> | ||
</nav> | ||
</aside> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.