2023-01-17 18:31:51 +01:00
|
|
|
<script lang="ts">
|
2023-06-14 20:39:36 +02:00
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
import BaseUIElement from "../BaseUIElement"
|
|
|
|
import Img from "./Img"
|
2023-06-15 05:38:52 +02:00
|
|
|
import { twJoin, twMerge } from "tailwind-merge"
|
2023-01-17 18:31:51 +01:00
|
|
|
|
2023-03-09 23:19:49 +01:00
|
|
|
export let imageUrl: string | BaseUIElement = undefined
|
2023-06-15 05:48:00 +02:00
|
|
|
export const message: string | BaseUIElement = undefined
|
2023-02-03 16:11:46 +01:00
|
|
|
export let options: {
|
|
|
|
imgSize?: string
|
|
|
|
extraClasses?: string
|
2023-03-09 23:19:49 +01:00
|
|
|
} = {}
|
2023-01-17 18:31:51 +01:00
|
|
|
|
2023-06-15 05:38:52 +02:00
|
|
|
let imgClasses = twJoin("block justify-center shrink-0 mr-4", options?.imgSize ?? "h-11 w-11")
|
2023-06-14 20:39:36 +02:00
|
|
|
const dispatch = createEventDispatcher<{ click }>()
|
2023-01-17 18:31:51 +01:00
|
|
|
</script>
|
|
|
|
|
2023-05-11 02:17:41 +02:00
|
|
|
<button
|
2023-06-15 05:38:52 +02:00
|
|
|
class={twMerge(options.extraClasses, "secondary no-image-background")}
|
2023-06-15 16:12:46 +02:00
|
|
|
on:click={(e) => dispatch("click", e)}
|
|
|
|
>
|
2023-02-03 16:11:46 +01:00
|
|
|
<slot name="image">
|
2023-02-11 15:04:20 +01:00
|
|
|
{#if imageUrl !== undefined}
|
|
|
|
{#if typeof imageUrl === "string"}
|
2023-06-14 20:39:36 +02:00
|
|
|
<Img src={imageUrl} class={imgClasses} />
|
2023-02-09 00:10:59 +01:00
|
|
|
{/if}
|
2023-02-11 15:04:20 +01:00
|
|
|
{/if}
|
2023-02-03 16:11:46 +01:00
|
|
|
</slot>
|
2023-02-11 15:04:20 +01:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
<slot name="message" />
|
2023-05-11 02:17:41 +02:00
|
|
|
</button>
|