remix-nlux
Version:
Remix IDE NLUX integration. Remix IDE is the leading IDE for building and deploying smart contracts on Ethereum. NLUX is a JavaScript and React library for building conversational AI experiences.
22 lines (19 loc) • 719 B
text/typescript
export const greetingTextClassName = 'nlux-comp-welcomeMessage-text';
export const updateGreetingText = (
root: HTMLElement,
newGreeting: string | undefined,
) => {
const greetingContainer = root.querySelector(`.${greetingTextClassName}`);
if (newGreeting === '' || newGreeting === undefined) {
greetingContainer?.remove();
return;
}
if (greetingContainer) {
greetingContainer.textContent = newGreeting;
} else {
const greetingTextContainer = document.createElement('div');
greetingTextContainer.classList.add(greetingTextClassName);
greetingTextContainer.textContent = newGreeting;
root.appendChild(greetingTextContainer);
}
};