forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangelog.tsx
More file actions
58 lines (53 loc) · 1.84 KB
/
Changelog.tsx
File metadata and controls
58 lines (53 loc) · 1.84 KB
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
import React from 'react'
import GithubSlugger from 'github-slugger'
import cx from 'classnames'
import { LinkIconHeading } from 'components/article/LinkIconHeading'
import { ChangelogItemT } from 'components/graphql/types'
import styles from 'components/ui/MarkdownContent/MarkdownContent.module.scss'
type Props = {
changelogItems: ChangelogItemT[]
}
export function Changelog({ changelogItems }: Props) {
const changes = changelogItems.map((item) => {
const heading = `Schema changes for ${item.date}`
const slugger = new GithubSlugger()
const slug = slugger.slug(heading)
return (
<div key={item.date}>
<h2 id={slug}>
<LinkIconHeading slug={slug} />
{heading}
</h2>
{(item.schemaChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</ul>
</React.Fragment>
))}
{(item.previewChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
<ul>
{change.changes.map((change) => (
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</ul>
</React.Fragment>
))}
{(item.upcomingChanges || []).map((change, index) => (
<React.Fragment key={index}>
<p>{change.title}</p>
{change.changes.map((change) => (
<li key={change} dangerouslySetInnerHTML={{ __html: change }} />
))}
</React.Fragment>
))}
</div>
)
})
return <div className={cx(styles.markdownBody, styles.automatedPages)}>{changes}</div>
}