2021-07-30 14:58:34 +02:00
|
|
|
<script>
|
2022-02-07 16:15:28 +01:00
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
|
2021-07-30 14:58:34 +02:00
|
|
|
export let type = "info"
|
|
|
|
export let icon = "Info"
|
|
|
|
export let message = ""
|
2022-02-07 16:15:28 +01:00
|
|
|
export let dismissable = false
|
|
|
|
|
|
|
|
const dispatch = createEventDispatcher()
|
2021-07-30 14:58:34 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="spectrum-Toast spectrum-Toast--{type}">
|
|
|
|
{#if icon}
|
|
|
|
<svg
|
|
|
|
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Toast-typeIcon"
|
|
|
|
focusable="false"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
<div class="spectrum-Toast-body">
|
|
|
|
<div class="spectrum-Toast-content">{message || ""}</div>
|
|
|
|
</div>
|
2022-02-07 16:15:28 +01:00
|
|
|
{#if dismissable}
|
|
|
|
<div class="spectrum-Toast-buttons">
|
|
|
|
<button
|
|
|
|
class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--sizeM"
|
|
|
|
on:click={() => dispatch("dismiss")}
|
|
|
|
>
|
|
|
|
<div class="spectrum-ClearButton-fill">
|
|
|
|
<svg
|
|
|
|
class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100"
|
|
|
|
focusable="false"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<use xlink:href="#spectrum-css-icon-Cross100" />
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2021-07-30 14:58:34 +02:00
|
|
|
</div>
|
2022-02-07 16:15:28 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.spectrum-Toast {
|
|
|
|
pointer-events: all;
|
|
|
|
}
|
|
|
|
</style>
|