app-walkthrough
Version:
An intuitive guided walkthrough library with UI highlighting and voice narration for web apps.
22 lines (21 loc) • 608 B
JavaScript
// domUtils.ts
export function createIconHtml(iconName = "add") {
const iconClass = `${iconName}-icon`;
return `
<span class="fc-btn-icon">
<span class="fc-icon">
<span class="${iconClass}">${iconName}</span>
</span>
</span>
`.trim();
}
export function createElementHtml({ tag = "button", text = "", className = "", iconName, }) {
const iconHtml = iconName ? createIconHtml(iconName) : "";
const typeAttr = tag === "button" ? ` type="button"` : "";
return `
<${tag}${typeAttr} class="${className}">
${iconHtml}
<span>${text}</span>
</${tag}>
`.trim();
}