Skip to content

Commit

Permalink
fix(button): btn disable
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso authored and Zephyruso committed Sep 8, 2023
1 parent 654a07f commit 59a7273
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ export const Button: ParentComponent<

return (
<button
class={twMerge(
'btn',
local.disabled && 'btn-disabled',
local.loading ? 'btn-disabled' : local.class,
)}
class={twMerge('btn', local.loading ? 'btn-disabled' : local.class)}
{...others}
onClick={(e) => {
if (props.disabled) {
e.preventDefault()
e.stopPropagation()

return
}

if (typeof props.onClick === 'function') {
props.onClick(e)
}
}}
>
<Show when={local.loading}>
<span class="loading loading-spinner" />
Expand Down

0 comments on commit 59a7273

Please sign in to comment.