budibase/packages/builder/src/common/ErrorsBox.svelte

30 lines
533 B
Svelte
Raw Normal View History

2019-07-13 11:35:57 +02:00
<script>
2020-02-03 10:50:30 +01:00
export let errors = []
2019-07-13 11:35:57 +02:00
2020-02-03 10:50:30 +01:00
$: hasErrors = errors.length > 0
2019-07-13 11:35:57 +02:00
</script>
{#if hasErrors}
2020-02-03 10:50:30 +01:00
<div class="error-container">
2019-07-13 11:35:57 +02:00
{#each errors as error}
2020-02-03 10:50:30 +01:00
<div class="error-row">
{error.field ? `${error.field}: ` : ''}{error.error}
</div>
2019-07-13 11:35:57 +02:00
{/each}
2020-02-03 10:50:30 +01:00
</div>
2019-07-13 11:35:57 +02:00
{/if}
<style>
2020-02-03 10:50:30 +01:00
.error-container {
padding: 10px;
2019-07-13 11:35:57 +02:00
border-style: solid;
border-color: var(--deletion100);
border-radius: var(--borderradiusall);
background: var(--deletion75);
2020-02-03 10:50:30 +01:00
}
2019-07-13 11:35:57 +02:00
2020-02-03 10:50:30 +01:00
.error-row {
2019-07-13 11:35:57 +02:00
padding: 5px 0px;
2020-02-03 10:50:30 +01:00
}
</style>