@azure-utils/storybooks
Version:
Utils to upload and manage Storybooks via Azure Functions and storage.
92 lines (90 loc) • 2.45 kB
JavaScript
const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_store = require('./store-CYxr095K.cjs');
const require_table = require('./table-CnB0C2aQ.cjs');
//#region src/components/labels-table.tsx
var import_jsx_runtime = require_chunk.__toESM(require_store.require_jsx_runtime());
async function LabelsTable({ labels, projectId, toolbar, caption }) {
const { locale } = require_store.getStore();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(require_table.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: require_store.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: require_store.urlBuilder.buildSHA(projectId, item.buildSHA),
children: "Build"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
href: require_store.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
Object.defineProperty(exports, 'LabelsTable', {
enumerable: true,
get: function () {
return LabelsTable;
}
});