UNPKG

@azure-utils/storybooks

Version:

Utils to upload and manage Storybooks via Azure Functions and storage.

102 lines (100 loc) 2.73 kB
import { __toESM, getStore, require_jsx_runtime, urlBuilder } from "./store-BL4RNiEp.mjs"; import { DEFAULT_GITHUB_BRANCH } from "./constants-CsV1N9r4.mjs"; import { Table } from "./table-CFLDF1bd.mjs"; //#region src/components/projects-table.tsx var import_jsx_runtime = __toESM(require_jsx_runtime()); async function ProjectsTable({ caption, toolbar, projects }) { const { locale } = getStore(); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, { caption: caption ?? `Projects (${projects.length})`, toolbar, data: projects, columns: [ { id: "id", header: "ID", cell: (item) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { safe: true, href: urlBuilder.projectId(item.id), children: item.id }); } }, { id: "name", header: "Name" }, { id: "gitHub", header: "GitHub", cell: (item) => { const pathnames = item.gitHubPath ? [ "tree", item.gitHubDefaultBranch || DEFAULT_GITHUB_BRANCH, item.gitHubPath ] : []; const href = urlBuilder.gitHub(item.gitHubRepo, ...pathnames); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { safe: true, href, target: "_blank", rel: "noopener noreferrer", children: item.gitHubRepo }); } }, { id: "build", header: "Latest build", cell: (item) => { if (!item.buildSHA) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "description", children: "No build available" }); return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: "1rem", flexWrap: "wrap" }, children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { safe: true, style: { fontFamily: "monospace" }, children: [ "[", item.buildSHA.slice(0, 7), "]" ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: urlBuilder.buildSHA(item.id, item.buildSHA), children: "Build" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: urlBuilder.storybookIndexHtml(item.id, item.buildSHA), children: "Storybook" }) ] }); } }, { id: "timestamp", header: "Last modified", cell: (item) => { if (!item.timestamp) return null; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { datetime: item.timestamp, safe: true, children: new Date(item.timestamp).toLocaleString(locale) }); } } ] }); } //#endregion export { ProjectsTable }; //# sourceMappingURL=projects-table-B_qW44SW.mjs.map