pleshevski.ru/modules/work/ChronologicalWorksTable/ChronologicalWorksTable.ts

55 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-06-20 16:30:27 +03:00
import { AnyNode, E } from "ren/node.ts";
import { WorkLink } from "../mod.ts";
import { renderDate } from "../../../render.ts";
import { CHRONOLOGICAL_WORKS } from "../data.ts";
import { RoleList } from "./RoleList.ts";
2023-06-20 16:56:46 +03:00
import { TechnologyList } from "./TechnologyList.ts";
2023-06-20 16:30:27 +03:00
export type ChronologicalWorksTableTranslations = Readonly<
Record<
| "Name"
| "Description"
| "Role"
| "Technologies"
| "Start"
| "Status_or_End",
string
>
>;
2023-06-20 16:56:46 +03:00
const tr = E.bind(null, "tr", []);
const td = E.bind(null, "td", []);
const th = E.bind(null, "th", []);
2023-06-20 16:30:27 +03:00
export const ChronologicalWorksTable = (
i18n: ChronologicalWorksTableTranslations,
): AnyNode =>
E("table", [], [
E("thead", [], [
tr([
th(i18n.Name),
th(i18n.Description),
th(i18n.Role),
th(i18n.Technologies),
th(i18n.Start),
th(i18n.Status_or_End),
]),
]),
E(
"tbody",
[],
2023-06-20 16:56:46 +03:00
CHRONOLOGICAL_WORKS.map((work) =>
tr([
2023-06-20 16:30:27 +03:00
td([WorkLink(work)]),
td(work.description),
td([RoleList(work.roles)]),
2023-06-20 16:56:46 +03:00
td([TechnologyList(work.technologies)]),
2023-06-20 16:30:27 +03:00
td(renderDate(work.startDate)),
td(
work.endDate ? renderDate(work.endDate) : work.status,
),
2023-06-20 16:56:46 +03:00
])
),
2023-06-20 16:30:27 +03:00
),
]);