UNPKG

@azure-utils/storybooks

Version:

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

107 lines (105 loc) 2.93 kB
const require_chunk = require('./chunk-DWy1uDak.cjs'); const require_constants = require('./constants-94H7Co6A.cjs'); const require_store = require('./store-CYxr095K.cjs'); const require_table = require('./table-CnB0C2aQ.cjs'); //#region src/components/projects-table.tsx var import_jsx_runtime = require_chunk.__toESM(require_store.require_jsx_runtime()); async function ProjectsTable({ caption, toolbar, projects }) { const { locale } = require_store.getStore(); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(require_table.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: require_store.urlBuilder.projectId(item.id), children: item.id }); } }, { id: "name", header: "Name" }, { id: "gitHub", header: "GitHub", cell: (item) => { const pathnames = item.gitHubPath ? [ "tree", item.gitHubDefaultBranch || require_constants.DEFAULT_GITHUB_BRANCH, item.gitHubPath ] : []; const href = require_store.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: require_store.urlBuilder.buildSHA(item.id, item.buildSHA), children: "Build" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: require_store.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 Object.defineProperty(exports, 'ProjectsTable', { enumerable: true, get: function () { return ProjectsTable; } });