/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / web-ui / src / pages / Algorithms.tsx
139 lines · 4.1 KBCodeBlameHistory
0968553routingJeremy Magland 1import { Algorithm } from "../types";
db4e6b9links to source codeJeremy Magland 2import { Link } from "react-router-dom";
0968553routingJeremy Magland 3
4interface AlgorithmsProps {
5 algorithms: Algorithm[];
6}
8function Algorithms({ algorithms }: AlgorithmsProps) {
85d3449pagesJeremy Magland 9 return (
10 <div>
11 <h1
12 style={{
13 fontSize: "2rem",
14 fontWeight: "bold",
15 color: "#333",
16 marginBottom: "1rem",
17 }}
18 >
19 Compression Algorithms
20 </h1>
0968553routingJeremy Magland 21 <div style={{ overflowX: "auto" }}>
22 <table style={{ width: "100%", borderCollapse: "collapse" }}>
23 <thead>
24 <tr style={{ backgroundColor: "#f5f5f5" }}>
25 <th
26 style={{
27 padding: "12px",
28 textAlign: "left",
29 borderBottom: "2px solid #ddd",
30 }}
31 >
32 Name
33 </th>
34 <th
35 style={{
36 padding: "12px",
37 textAlign: "left",
38 borderBottom: "2px solid #ddd",
39 }}
40 >
41 Version
42 </th>
43 <th
44 style={{
45 padding: "12px",
46 textAlign: "left",
47 borderBottom: "2px solid #ddd",
48 }}
49 >
50 Description
51 </th>
52 <th
53 style={{
54 padding: "12px",
55 textAlign: "left",
56 borderBottom: "2px solid #ddd",
57 }}
58 >
59 Tags
60 </th>
db4e6b9links to source codeJeremy Magland 61 <th
62 style={{
63 padding: "12px",
64 textAlign: "left",
65 borderBottom: "2px solid #ddd",
66 }}
67 >
68 Source
69 </th>
0968553routingJeremy Magland 70 </tr>
71 </thead>
72 <tbody>
73 {algorithms.map((algorithm, index) => (
74 <tr
75 key={`${algorithm.name}-${algorithm.version}`}
76 style={{
77 backgroundColor: index % 2 === 0 ? "white" : "#fafafa",
78 }}
79 >
80 <td style={{ padding: "12px", borderBottom: "1px solid #ddd" }}>
db4e6b9links to source codeJeremy Magland 81 <Link
82 to={`/home?algorithm=${encodeURIComponent(algorithm.name)}`}
83 style={{
84 color: "#0066cc",
85 textDecoration: "none",
86 fontWeight: "500",
87 }}
88 >
89 {algorithm.name}
90 </Link>
0968553routingJeremy Magland 91 </td>
92 <td style={{ padding: "12px", borderBottom: "1px solid #ddd" }}>
93 {algorithm.version}
94 </td>
95 <td style={{ padding: "12px", borderBottom: "1px solid #ddd" }}>
96 {algorithm.description}
97 </td>
98 <td style={{ padding: "12px", borderBottom: "1px solid #ddd" }}>
99 {algorithm.tags.map((tag) => (
100 <span
101 key={tag}
102 style={{
103 display: "inline-block",
104 backgroundColor: "#e1e1e1",
105 padding: "4px 8px",
106 borderRadius: "4px",
107 margin: "2px",
108 fontSize: "0.9em",
109 }}
110 >
111 {tag}
112 </span>
113 ))}
114 </td>
db4e6b9links to source codeJeremy Magland 115 <td style={{ padding: "12px", borderBottom: "1px solid #ddd" }}>
116 {algorithm.source_file && (
117 <a
118 href={algorithm.source_file}
119 target="_blank"
120 rel="noopener noreferrer"
121 style={{
122 color: "#0066cc",
123 textDecoration: "none",
124 }}
125 >
126 View Source
127 </a>
128 )}
129 </td>
0968553routingJeremy Magland 130 </tr>
131 ))}
132 </tbody>
133 </table>
85d3449pagesJeremy Magland 134 </div>
135 </div>
136 );
139export default Algorithms;
moveopenescclose