| 2260 | /** | 2260 | /** |
| 2261 | * Updates the content and style of an information block | 2261 | * Updates the content and style of an information block |
| 2262 | * @param {string | HTMLElement} target - The CSS selector or the HTML element of the information block | 2262 | * @param {string | HTMLElement} target - The CSS selector or the HTML element of the information block |
| 2263 | * @param {string | HTMLElement} content - The message to display inside the information block (supports HTML) or an HTML element | 2263 | * @param {string | HTMLElement?} content - The message to display inside the information block (supports HTML) or an HTML element |
| 2264 | * @param {'hint' | 'info' | 'warning' | 'error'} [type='info'] - The type of message, which determines the styling of the information block | 2264 | * @param {'hint' | 'info' | 'warning' | 'error'} [type='info'] - The type of message, which determines the styling of the information block |
| 2265 | */ | 2265 | */ |
| 2266 | export function setInfoBlock(target, content, type = 'info') { | 2266 | export function setInfoBlock(target, content, type = 'info') { |
| | 2267 | if (!content) { |
| | 2268 | clearInfoBlock(target); |
| | 2269 | return; |
| | 2270 | } |
| | 2271 | |
| 2267 | const infoBlock = typeof target === 'string' ? document.querySelector(target) : target; | 2272 | const infoBlock = typeof target === 'string' ? document.querySelector(target) : target; |
| 2268 | if (infoBlock) { | 2273 | if (infoBlock) { |
| 2269 | infoBlock.className = `info-block ${type}`; | 2274 | infoBlock.className = `info-block ${type}`; |