From 3352727aa638fcfcc6461d2aaded8ef9603acc0d Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Tue, 4 Oct 2022 00:04:19 +0800
Subject: feat: Initial setup facilitating testing

---
 apps/kit/src/lib/components/button.svelte | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'apps/kit/src/lib/components/button.svelte')

diff --git a/apps/kit/src/lib/components/button.svelte b/apps/kit/src/lib/components/button.svelte
index d345b37..cbc09e2 100644
--- a/apps/kit/src/lib/components/button.svelte
+++ b/apps/kit/src/lib/components/button.svelte
@@ -4,6 +4,8 @@
 </script>
 
 <script lang="ts">
+    import pwKey from "$actions/pwKey";
+
     import { SpinnerIcon } from "./icons";
 
     export let kind = "primary" as ButtonKind;
@@ -18,6 +20,7 @@
     export let text: string;
     export let loading = false;
     export let fullWidth = false;
+    export let _pwKey: string | undefined = undefined;
 
     let sizeClasses = "";
     let kindClasses = "";
@@ -70,9 +73,9 @@
 
 {#if href}
     <a
+        use:pwKey={_pwKey}
         {...shared_props}
         {href}
-        on:click
         class="{sizeClasses} {kindClasses} {loading ? 'disabled:' : ''} {$$restProps.class ?? ''} {fullWidth
             ? 'w-full justify-center'
             : ''} inline-flex items-center border font-medium rounded shadow-sm focus:outline-none focus:ring-2"
@@ -84,8 +87,11 @@
     </a>
 {:else}
     <button
+        use:pwKey={_pwKey}
         {...shared_props}
-        class="{sizeClasses} {kindClasses} {$$restProps.class ?? ''} {fullWidth
+        on:click
+        class="{sizeClasses} {kindClasses} {$$restProps.class ?? ''}
+        {fullWidth
             ? 'w-full justify-center'
             : ''} inline-flex items-center border font-medium rounded shadow-sm focus:outline-none focus:ring-2"
     >
-- 
cgit v1.3

