forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGHESReleaseNotePatch.tsx
95 lines (84 loc) · 3.09 KB
/
GHESReleaseNotePatch.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { useRef } from 'react'
import dayjs from 'dayjs'
import { useTranslation } from 'components/hooks/useTranslation'
import { PatchNotes } from './PatchNotes'
import { Link } from 'components/Link'
import { CurrentVersion, ReleaseNotePatch, GHESMessage } from './types'
type Props = {
patch: ReleaseNotePatch
currentVersion: CurrentVersion
latestPatch: string
latestRelease: string
message: GHESMessage
}
export function GHESReleaseNotePatch({
patch,
currentVersion,
latestPatch,
latestRelease,
message,
}: Props) {
const { t } = useTranslation('header')
const containerRef = useRef<HTMLDivElement>(null)
return (
<div ref={containerRef} className="mb-10 pb-6" id={patch.version}>
<header
style={{ zIndex: 1, marginTop: -1 }}
className="container-xl border-top border-bottom px-3 pt-4 pb-2"
>
<div className="d-flex flex-justify-between flex-wrap">
<h2 className="border-bottom-0 m-0 p-0 mt-2">
{currentVersion.versionTitle}.{patch.patchVersion}
</h2>
{patch.release_candidate && (
<span
className="IssueLabel color-bg-attention-emphasis color-fg-on-emphasis ml-3 flex-items-center d-inline-flex"
style={{ whiteSpace: 'pre' }}
>
Release Candidate
</span>
)}
{currentVersion.plan === 'enterprise-server' && (
<Link
href={`https://enterprise.github.com/releases/${patch.downloadVersion}/download`}
className="btn btn-outline mt-2 text-small text-bold no-underline"
>
Download GitHub Enterprise Server {patch.downloadVersion}
</Link>
)}
</div>
<p className="color-fg-muted mt-1">{dayjs(patch.date).format('MMMM DD, YYYY')}</p>
{patch.version !== latestPatch && currentVersion.currentRelease === latestRelease && (
<p className="color-fg-muted mt-1">
<span
dangerouslySetInnerHTML={{ __html: message.ghes_release_notes_upgrade_patch_only }}
/>{' '}
{t('notices.release_notes_use_latest')}
</p>
)}
{patch.version === latestPatch && currentVersion.currentRelease !== latestRelease && (
<p className="color-fg-muted mt-1">
<span
dangerouslySetInnerHTML={{ __html: message.ghes_release_notes_upgrade_release_only }}
/>{' '}
{t('notices.release_notes_use_latest')}
</p>
)}
{patch.version !== latestPatch && currentVersion.currentRelease !== latestRelease && (
<p className="color-fg-muted mt-1">
<span
dangerouslySetInnerHTML={{
__html: message.ghes_release_notes_upgrade_patch_and_release,
}}
/>{' '}
{t('notices.release_notes_use_latest')}
</p>
)}
</header>
<div className="container-xl px-3">
<div className="mt-3" dangerouslySetInnerHTML={{ __html: patch.intro }} />
<PatchNotes patch={patch} />
</div>
</div>
)
}