|
1 | | -import * as React from "react"; |
2 | | -import Table from "@mui/material/Table"; |
3 | | -import TableBody from "@mui/material/TableBody"; |
4 | | -import TableCell from "@mui/material/TableCell"; |
5 | | -import TableRow from "@mui/material/TableRow"; |
6 | | -import Link from "@mui/material/Link"; |
7 | | -// import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; |
8 | | -import Translate, { translate } from "@docusaurus/Translate"; |
9 | | - |
10 | | -export default function VersionsTable(props) { |
11 | | - // const { siteConfig } = useDocusaurusContext(); |
12 | | - return ( |
13 | | - <Table size="small"> |
14 | | - <TableBody> |
15 | | - <TableRow key="header"> |
16 | | - {["Release", "Binary", "Source", "Release notes"].map((header) => ( |
17 | | - <TableCell |
18 | | - className="border-gray-300 font-bold" |
19 | | - sx={{ border: 1, color: "inherit" }} |
20 | | - align="left" |
21 | | - key={header} |
22 | | - > |
23 | | - <Translate>{header}</Translate> |
24 | | - </TableCell> |
25 | | - ))} |
26 | | - </TableRow> |
27 | | - {props.data.map((row, index) => ( |
28 | | - <TableRow key={index}> |
29 | | - <TableCell |
30 | | - className="border-gray-300 font-bold" |
31 | | - sx={{ border: 1, color: "inherit" }} |
32 | | - align="left" |
33 | | - > |
34 | | - <Translate>{row.release}</Translate> |
35 | | - </TableCell> |
36 | | - <TableCell |
37 | | - className="border-gray-300" |
38 | | - sx={{ border: 1 }} |
39 | | - align="left" |
40 | | - > |
41 | | - <Link className="text-primary" href={row.binary} underline="none"> |
42 | | - {row.binaryText + " "} |
43 | | - </Link> |
44 | | - ( |
45 | | - <Link |
46 | | - className="text-primary" |
47 | | - href={row.binaryAsc} |
48 | | - underline="none" |
49 | | - > |
50 | | - asc |
51 | | - </Link> |
52 | | - , |
53 | | - <Link |
54 | | - className="text-primary" |
55 | | - href={row.binarySha} |
56 | | - underline="none" |
57 | | - > |
58 | | - {row.binaryShaText} |
59 | | - </Link> |
60 | | - ) |
61 | | - </TableCell> |
62 | | - <TableCell |
63 | | - className="border-gray-300" |
64 | | - sx={{ border: 1 }} |
65 | | - align="left" |
66 | | - > |
67 | | - <Link className="text-primary" href={row.source} underline="none"> |
68 | | - {row.sourceText + " "} |
69 | | - </Link> |
70 | | - ( |
71 | | - <Link |
72 | | - className="text-primary" |
73 | | - href={row.sourceAsc} |
74 | | - underline="none" |
75 | | - > |
76 | | - asc |
77 | | - </Link> |
78 | | - , |
79 | | - <Link |
80 | | - className="text-primary" |
81 | | - href={row.sourceSha} |
82 | | - underline="none" |
83 | | - > |
84 | | - {row.sourceShaText} |
85 | | - </Link> |
86 | | - ) |
87 | | - </TableCell> |
88 | | - <TableCell |
89 | | - className="border-gray-300" |
90 | | - sx={{ border: 1 }} |
91 | | - align="left" |
92 | | - > |
93 | | - <Link |
94 | | - className="text-primary" |
95 | | - href={row.releaseNote} |
96 | | - underline="none" |
97 | | - > |
98 | | - <Translate>Release Notes</Translate> |
99 | | - </Link> |
100 | | - </TableCell> |
101 | | - </TableRow> |
102 | | - ))} |
103 | | - </TableBody> |
104 | | - </Table> |
105 | | - ); |
106 | | -} |
| 1 | +import * as React from "react"; |
| 2 | +import Table from "@mui/material/Table"; |
| 3 | +import TableBody from "@mui/material/TableBody"; |
| 4 | +import TableCell from "@mui/material/TableCell"; |
| 5 | +import TableRow from "@mui/material/TableRow"; |
| 6 | +import Link from "@mui/material/Link"; |
| 7 | +// import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; |
| 8 | +import Translate, { translate } from "@docusaurus/Translate"; |
| 9 | + |
| 10 | +export default function VersionsTable(props) { |
| 11 | + // const { siteConfig } = useDocusaurusContext(); |
| 12 | + const rows = props.data || []; |
| 13 | + const hasBinary = rows.some((r) => r && r.binary); |
| 14 | + const headers = hasBinary |
| 15 | + ? ["Release", "Binary", "Source", "Release notes"] |
| 16 | + : ["Release", "Source", "Release notes"]; |
| 17 | + return ( |
| 18 | + <Table size="small"> |
| 19 | + <TableBody> |
| 20 | + <TableRow key="header"> |
| 21 | + {headers.map((header) => ( |
| 22 | + <TableCell |
| 23 | + className="border-gray-300 font-bold" |
| 24 | + sx={{ border: 1, color: "inherit" }} |
| 25 | + align="left" |
| 26 | + key={header} |
| 27 | + > |
| 28 | + <Translate>{header}</Translate> |
| 29 | + </TableCell> |
| 30 | + ))} |
| 31 | + </TableRow> |
| 32 | + {rows.map((row, index) => ( |
| 33 | + <TableRow key={index}> |
| 34 | + <TableCell |
| 35 | + className="border-gray-300 font-bold" |
| 36 | + sx={{ border: 1, color: "inherit" }} |
| 37 | + align="left" |
| 38 | + > |
| 39 | + <Translate>{row.release}</Translate> |
| 40 | + </TableCell> |
| 41 | + {hasBinary && ( |
| 42 | + <TableCell |
| 43 | + className="border-gray-300" |
| 44 | + sx={{ border: 1 }} |
| 45 | + align="left" |
| 46 | + > |
| 47 | + {row.binary ? ( |
| 48 | + <> |
| 49 | + <Link |
| 50 | + className="text-primary" |
| 51 | + href={row.binary} |
| 52 | + underline="none" |
| 53 | + > |
| 54 | + {row.binaryText + " "} |
| 55 | + </Link> |
| 56 | + ( |
| 57 | + <Link |
| 58 | + className="text-primary" |
| 59 | + href={row.binaryAsc} |
| 60 | + underline="none" |
| 61 | + > |
| 62 | + asc |
| 63 | + </Link> |
| 64 | + , |
| 65 | + <Link |
| 66 | + className="text-primary" |
| 67 | + href={row.binarySha} |
| 68 | + underline="none" |
| 69 | + > |
| 70 | + {row.binaryShaText} |
| 71 | + </Link> |
| 72 | + ) |
| 73 | + </> |
| 74 | + ) : null} |
| 75 | + </TableCell> |
| 76 | + )} |
| 77 | + <TableCell |
| 78 | + className="border-gray-300" |
| 79 | + sx={{ border: 1 }} |
| 80 | + align="left" |
| 81 | + > |
| 82 | + <Link className="text-primary" href={row.source} underline="none"> |
| 83 | + {row.sourceText + " "} |
| 84 | + </Link> |
| 85 | + ( |
| 86 | + <Link |
| 87 | + className="text-primary" |
| 88 | + href={row.sourceAsc} |
| 89 | + underline="none" |
| 90 | + > |
| 91 | + asc |
| 92 | + </Link> |
| 93 | + , |
| 94 | + <Link |
| 95 | + className="text-primary" |
| 96 | + href={row.sourceSha} |
| 97 | + underline="none" |
| 98 | + > |
| 99 | + {row.sourceShaText} |
| 100 | + </Link> |
| 101 | + ) |
| 102 | + </TableCell> |
| 103 | + <TableCell |
| 104 | + className="border-gray-300" |
| 105 | + sx={{ border: 1 }} |
| 106 | + align="left" |
| 107 | + > |
| 108 | + {row.releaseNote ? ( |
| 109 | + <Link |
| 110 | + className="text-primary" |
| 111 | + href={row.releaseNote} |
| 112 | + underline="none" |
| 113 | + > |
| 114 | + <Translate>Release Notes</Translate> |
| 115 | + </Link> |
| 116 | + ) : null} |
| 117 | + </TableCell> |
| 118 | + </TableRow> |
| 119 | + ))} |
| 120 | + </TableBody> |
| 121 | + </Table> |
| 122 | + ); |
| 123 | +} |
0 commit comments