Skip to content

Commit 1898945

Browse files
committed
Add more previous version links
1 parent 6e28178 commit 1898945

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

src/routes/VersionsRoute.tsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,49 @@
1+
import { Fragment } from "react/jsx-runtime";
12
import { Box } from "../components/Box";
23
import { ExternalLink } from "../components/ExternalLink";
34
import { Header } from "../components/Header";
5+
import TagsIcon from "../../public/svgs/tags.svg?react";
46

57
export default function VersionsRoute() {
68
return (
79
<Box direction="column" gap={2}>
810
<Header title="Previous releases" />
911
<div>Click below to view documentation for past releases.</div>
10-
<div className="text-lg">Version 2</div>
11-
<ul className="pl-8">
12-
{Object.entries(VERSIONS).map(([version, url]) => (
13-
<VersionLink key={version} url={url} version={version} />
12+
{Object.entries(VERSIONS)
13+
.sort((a, b) => b[0].localeCompare(a[0]))
14+
.map(([major, minors]) => (
15+
<Fragment key={major}>
16+
<div className="text-lg">Version {major}</div>
17+
<ul className="pl-8">
18+
{Object.entries(minors)
19+
.sort((a, b) => b[0].localeCompare(a[0]))
20+
.map(([version, url]) => (
21+
<VersionLink key={version} url={url} version={version} />
22+
))}
23+
</ul>
24+
</Fragment>
1425
))}
15-
</ul>
16-
<div className="text-lg">Version 1</div>
17-
<ul className="pl-8">
18-
<VersionLink url="https://react-window-v1.vercel.app" version="1.8" />
19-
</ul>
2026
</Box>
2127
);
2228
}
2329

2430
const VERSIONS = {
25-
"2.2": "https://react-window-9gegorjnr-brian-vaughns-projects.vercel.app",
26-
"2.1": "https://react-window-8cygyvomv-brian-vaughns-projects.vercel.app",
27-
"2.0": "https://react-window-btpcws98u-brian-vaughns-projects.vercel.app"
31+
"2": {
32+
"2.2": "https://react-window-9gegorjnr-brian-vaughns-projects.vercel.app",
33+
"2.1": "https://react-window-8cygyvomv-brian-vaughns-projects.vercel.app",
34+
"2.0": "https://react-window-btpcws98u-brian-vaughns-projects.vercel.app"
35+
},
36+
"1": {
37+
"1.8": "https://react-window-v1.vercel.app",
38+
"1.7": "https://github.com/bvaughn/react-window/releases/tag/1.7.0",
39+
"1.6": "https://github.com/bvaughn/react-window/releases/tag/1.6.0",
40+
"1.5": "https://github.com/bvaughn/react-window/releases/tag/1.5.0",
41+
"1.4": "https://github.com/bvaughn/react-window/releases/tag/1.4.0",
42+
"1.3": "https://github.com/bvaughn/react-window/releases/tag/1.3.0",
43+
"1.2": "https://github.com/bvaughn/react-window/releases/tag/1.2.0",
44+
"1.1": "https://github.com/bvaughn/react-window/releases/tag/1.1.0",
45+
"1.0": "https://github.com/bvaughn/react-window/releases/tag/1.0.0"
46+
}
2847
};
2948

3049
function VersionLink({ url, version }: { url: string; version: string }) {
@@ -36,6 +55,9 @@ function VersionLink({ url, version }: { url: string; version: string }) {
3655
>
3756
{version}
3857
<span className="text-teal-600">.x</span>
58+
{url.startsWith("https://github") && (
59+
<TagsIcon className="inline w-4 h-4 ml-1 text-slate-600" />
60+
)}
3961
</ExternalLink>
4062
</li>
4163
);

0 commit comments

Comments
 (0)