1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00

Updating inline alert component to handle newlines as different elements, putting out error with new lines.

This commit is contained in:
mike12345567 2021-11-22 10:37:58 +00:00
parent 854cfd243d
commit 19c096c3e5
2 changed files with 6 additions and 2 deletions

View file

@ -8,6 +8,8 @@
export let onConfirm = undefined
$: icon = selectIcon(type)
// if newlines used, convert them to different elements
$: split = message.split("\n")
function selectIcon(alertType) {
switch (alertType) {
@ -33,7 +35,9 @@
<use xlink:href="#spectrum-icon-18-{icon}" />
</svg>
<div class="spectrum-InLineAlert-header">{header}</div>
<div class="spectrum-InLineAlert-content">{message}</div>
{#each split as splitMsg}
<div class="spectrum-InLineAlert-content">{splitMsg}</div>
{/each}
{#if onConfirm}
<div class="spectrum-InLineAlert-footer">
<Button secondary on:click={onConfirm}>OK</Button>

View file

@ -163,7 +163,7 @@ function updateError(error, newError, tables) {
error = ""
}
if (error.length > 0) {
error += " - "
error += "\n"
}
error += `${newError} ${tables.join(", ")}`
return error