@azure-utils/storybooks
Version:
Utils to upload and manage Storybooks via Azure Functions and storage.
87 lines (85 loc) • 2.28 kB
JavaScript
import { __toESM, getStore, require_jsx_runtime, urlBuilder } from "./store-BL4RNiEp.mjs";
import { Table } from "./table-CFLDF1bd.mjs";
//#region src/components/labels-table.tsx
var import_jsx_runtime = __toESM(require_jsx_runtime());
async function LabelsTable({ labels, projectId, toolbar, caption }) {
const { locale } = getStore();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
caption: caption ?? `Labels (${labels.length})`,
data: labels,
toolbar,
columns: [
{
id: "slug",
header: "Slug",
cell: (item) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
safe: true,
href: urlBuilder.labelSlug(projectId, item.slug),
children: item.slug
});
}
},
{
id: "value",
header: "Label"
},
{
id: "type",
header: "Type",
style: { fontFamily: "monospace" }
},
{
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(projectId, item.buildSHA),
children: "Build"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
href: urlBuilder.storybookIndexHtml(projectId, 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 { LabelsTable };
//# sourceMappingURL=labels-table-DoOmA3fT.mjs.map