/
index.tsx
50 lines (44 loc) · 1.13 KB
/
index.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
/** @module Components.Doc.Changelog */
import { useEffect, useState } from 'react'
import { Spin, Typography } from 'antd'
import { asyncFunctionExec } from '@/components/utils/asyncFunction'
/**
* Changelog
* @returns Changelog
*/
const Changelog: React.FunctionComponent = () => {
// State
const [content, setContent] = useState<string>()
// Load
useEffect(() => {
asyncFunctionExec(async () => {
try {
const res = await fetch(
'https://raw.githubusercontent.com/Airthium/tanatloc/master/CHANGELOG.md'
)
let changelog = await res.text()
setContent(changelog)
} catch (err: any) {
setContent(
'Unable to fetch CHANGELOG at https://github.com/Airthium/tanatloc/blob/master/CHANGELOG.md\n' +
err.message
)
}
})
}, [])
/**
* Render
*/
if (!content) return <Spin />
return (
<>
<Typography.Title level={3}>CHANGELOG</Typography.Title>
<Typography.Paragraph>
<blockquote>
<pre>{content}</pre>
</blockquote>
</Typography.Paragraph>
</>
)
}
export default Changelog