@octopusdeploy/design-system-components
Version:
The design systems component library.
35 lines (34 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calloutContent = exports.calloutBoldText = exports.calloutInlineCode = exports.calloutExternalLink = exports.calloutLink = void 0;
const calloutLink = (text, url, newTab = false) => {
return { type: "link", text, url, newTab };
};
exports.calloutLink = calloutLink;
// External links accept a short slug (resolved via the oc.to redirector) or a full URL, and render
// through ExternalLink so they get short-name resolution, the external-link icon, and link analytics.
const calloutExternalLink = (text, href) => ({ type: "externalLink", text, href });
exports.calloutExternalLink = calloutExternalLink;
const calloutInlineCode = (text) => {
return { type: "inline-code", text };
};
exports.calloutInlineCode = calloutInlineCode;
const calloutBoldText = (text) => {
return { type: "bold", text };
};
exports.calloutBoldText = calloutBoldText;
const calloutContent = (strings, ...values) => {
const content = [];
strings.forEach((str, index) => {
if (str !== "")
content.push(str);
if (index < values.length) {
const value = values[index];
if (value === null || value === undefined || value === "" || typeof value === "boolean")
return;
content.push(typeof value === "number" ? String(value) : value);
}
});
return content;
};
exports.calloutContent = calloutContent;