Updating inline alert component to handle newlines as different elements, putting out error with new lines.
This commit is contained in:
parent
38c7f3ab90
commit
9be833d5e1
|
@ -8,6 +8,8 @@
|
||||||
export let onConfirm = undefined
|
export let onConfirm = undefined
|
||||||
|
|
||||||
$: icon = selectIcon(type)
|
$: icon = selectIcon(type)
|
||||||
|
// if newlines used, convert them to different elements
|
||||||
|
$: split = message.split("\n")
|
||||||
|
|
||||||
function selectIcon(alertType) {
|
function selectIcon(alertType) {
|
||||||
switch (alertType) {
|
switch (alertType) {
|
||||||
|
@ -33,7 +35,9 @@
|
||||||
<use xlink:href="#spectrum-icon-18-{icon}" />
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
||||||
</svg>
|
</svg>
|
||||||
<div class="spectrum-InLineAlert-header">{header}</div>
|
<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}
|
{#if onConfirm}
|
||||||
<div class="spectrum-InLineAlert-footer">
|
<div class="spectrum-InLineAlert-footer">
|
||||||
<Button secondary on:click={onConfirm}>OK</Button>
|
<Button secondary on:click={onConfirm}>OK</Button>
|
||||||
|
|
|
@ -163,7 +163,7 @@ function updateError(error, newError, tables) {
|
||||||
error = ""
|
error = ""
|
||||||
}
|
}
|
||||||
if (error.length > 0) {
|
if (error.length > 0) {
|
||||||
error += " - "
|
error += "\n"
|
||||||
}
|
}
|
||||||
error += `${newError} ${tables.join(", ")}`
|
error += `${newError} ${tables.join(", ")}`
|
||||||
return error
|
return error
|
||||||
|
|
Loading…
Reference in New Issue