From f6a380d7a920f150f15f76a7d5bc4b9291064783 Mon Sep 17 00:00:00 2001 From: kodai3 Date: Fri, 3 May 2024 15:59:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20update=20a11y=20for=20lo?= =?UTF-8?q?ading=20status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kodai3 --- src/components/Button/Button.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index b210b82c..76528947 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -20,6 +20,7 @@ export const Button = forwardRef( type = 'button', disabled = false, loading = false, + onClick, ...props }, ref, @@ -36,8 +37,25 @@ export const Button = forwardRef( [styles.loading]: loading, }); + const handleClick = (e: React.MouseEvent) => { + if (loading) { + e.preventDefault(); + return; + } + + onClick?.(e); + }; + return ( -