summaryrefslogtreecommitdiffhomepage
path: root/src/features/surface-host/ui/Button.svelte
blob: ee9097c5f34da0d280184a2e743a52b2bd2bd57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script lang="ts">
  import type { InvokeMessage } from "@dispatch/ui-contract";
  import type { ButtonFieldView } from "../logic/types";

  let {
    field,
    surfaceId,
    onInvoke,
  }: { field: ButtonFieldView; surfaceId: string; onInvoke: (msg: InvokeMessage) => void } =
    $props();

  function handleClick() {
    onInvoke({
      type: "invoke",
      surfaceId,
      actionId: field.action.actionId,
    });
  }
</script>

<button onclick={handleClick}>{field.label}</button>