From cc5d96fc514621f47ea826561db9f037b87ccb6d Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Wed, 28 Sep 2022 21:50:55 +0800
Subject: feat: Support full width buttons

---
 apps/kit/src/lib/components/button.svelte | 10 +++++-----
 1 file changed, 5 insertions(+), 5 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 954f195..95dba5c 100644
--- a/apps/kit/src/lib/components/button.svelte
+++ b/apps/kit/src/lib/components/button.svelte
@@ -17,6 +17,7 @@
     export let href: string | undefined = undefined;
     export let text: string;
     export let loading = false;
+    export let fullWidth = false;
 
     let sizeClasses = "";
     let kindClasses = "";
@@ -75,10 +76,10 @@
         {...shared_props}
         {href}
         on:click
-        {type}
         class="{sizeClasses} {kindClasses} {loading
             ? 'disabled:'
-            : ''} inline-flex items-center border font-medium rounded shadow-sm focus:outline-none focus:ring-2"
+            : ''} {$$restProps.class ??
+            ''} {fullWidth ? 'w-full justify-center': ''} inline-flex items-center border font-medium rounded shadow-sm focus:outline-none focus:ring-2"
     >
         {#if loading}
             <Spinner class={spinnerTextClasses + " " + spinnerMarginClasses} />
@@ -88,9 +89,8 @@
 {:else}
     <button
         {...shared_props}
-        on:click
-        {type}
-        class="{sizeClasses} {kindClasses} inline-flex items-center border font-medium rounded shadow-sm focus:outline-none focus:ring-2"
+        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"
     >
         {#if loading}
             <Spinner class={spinnerTextClasses + " " + spinnerMarginClasses} />
-- 
cgit v1.3

