Skip to content

Commit

Permalink
Fix button clickable when disabled (#1891)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhilXavier95 authored Oct 19, 2023
1 parent 963ac44 commit 9f14161
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ const Button = React.forwardRef(
},
ref
) => {
let Parent, elementSpecificProps;
let Parent = motion.button;
let elementSpecificProps = { type };

const renderLabel = label || children;

if (to) {
Parent = Link;
elementSpecificProps = { to };
} else if (href) {
Parent = motion.a;
elementSpecificProps = { href };
} else {
Parent = motion.button;
elementSpecificProps = { type };
if (!disabled) {
if (to) {
Parent = Link;
elementSpecificProps = { to };
} else if (href) {
Parent = motion.a;
elementSpecificProps = { href };
}
}

const handleClick = e => {
Expand Down

0 comments on commit 9f14161

Please sign in to comment.