Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 51 52 | 1x 1x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 9x 9x 9x 9x 9x 9x 9x 9x 13x 13x 13x 13x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x | import * as core from "@actions/core";
import type { ContentProps } from "../index";
import { getExt, getHref, getLastModified, getSize } from "../shared/helper";
export function Table({ files, isRoot }: ContentProps) {
core.debug(`- Generated list: ${files.map((path) => path.name).join(", ")}`);
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Last Modified</th>
</tr>
</thead>
<tbody>
{!isRoot && <TableRow href={"../"} name=".." dataAttr={{ "data-type": "parent" }} />}
{files.map((path) => (
<TableRow
key={path.name}
dataAttr={{ "data-type": getExt(path) }}
href={getHref(path)}
name={path.name}
size={getSize(path)}
lastModified={getLastModified(path)}
/>
))}
</tbody>
</table>
);
}
interface TableRowProps {
href: string;
name: string;
size?: string;
lastModified?: string;
dataAttr?: Record<`data-${string}`, string>;
}
function TableRow({ href, name, size = "-", lastModified = "-", dataAttr = {} }: TableRowProps) {
return (
<tr data-name={name} {...dataAttr}>
<td>
<a href={href}>{name}</a>
</td>
<td>{size}</td>
<td>{lastModified}</td>
</tr>
);
}
|