Files
AtreidesAssetsFree/client/ui/alert.js
T

14 lines
868 B
JavaScript
Raw Normal View History

2026-10-29 11:57:29 +01:00
// Generated, do not edit. sha256:9524042357ce22fcf244cdc26ee3cb73b68a915569fd002433a8ce0705465b4d
import { esc } from './escape.js';
const ICONS = { info: 'ℹ️', success: '✓', error: '⚠️', neutral: '' };
export function alertHtml({ kind = 'neutral', title = '', body = '', icon, extra = '', className = '' }) {
if (!(kind in ICONS)) throw new Error(`Unknown alert kind: ${kind}.`);
const teken = icon === undefined ? ICONS[kind] : (icon || '');
const iconHtml = teken ? `<span class="alert-icon">${teken}</span>` : '';
const titleHtml = title ? `<div class="alert-title">${esc(title)}</div>` : '';
const bodyHtml = body ? `<div class="alert-body">${esc(body)}</div>` : '';
return `<div class="alert alert-${kind}${className ? ` ${className}` : ''}">${iconHtml}`
+ `<div class="alert-content">${titleHtml}${bodyHtml}${extra}</div></div>`;
}