Files
AtreidesAssetsFree/client/ui/alert.js
T
2026-10-29 11:57:29 +01:00

15 lines
868 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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>`;
}