Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,14 @@
|
||||
// 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>`;
|
||||
}
|
||||
Reference in new issue
Block a user