-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathindex.tsx
More file actions
50 lines (46 loc) · 1.33 KB
/
index.tsx
File metadata and controls
50 lines (46 loc) · 1.33 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
import {
BlogSidebarItem,
BlogSidebar as BlogSidebarType
} from "@docusaurus/plugin-content-blog";
import { GitHubRelease } from "@site/src/types/github";
import type { Props } from "@theme/BlogLayout";
import BlogSidebar from "@theme/BlogSidebar";
import Layout from "@theme/Layout";
import clsx from "clsx";
import styles from "./styles.module.scss";
export default function Changelog(
props: Props & { releases: GitHubRelease[] }
): JSX.Element {
const { toc, children, releases, ...layoutProps } = props;
const hasSidebar = true;
const sidebarItems: BlogSidebarItem[] = (releases ?? []).map(
({ tag_name, created_at }) => ({
title: tag_name,
permalink: `/changelog/release-${tag_name}`,
unlisted: false,
date: new Date(created_at)
})
);
let sidebar: BlogSidebarType = {
items: sidebarItems,
title: "Releases"
};
return (
<Layout {...layoutProps}>
<div className={`container ${styles.section}`}>
<div className="row">
<BlogSidebar sidebar={sidebar} />
<main
className={clsx("col", {
"col--7": hasSidebar,
"col--9 col--offset-1": !hasSidebar
})}
>
{children}
</main>
{toc && <div className="col col--2">{toc}</div>}
</div>
</div>
</Layout>
);
}