Skip to content

Commit

Permalink
fix: add not-clickable if href or onClick is missing (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Luca Tagliabue <[email protected]>
  • Loading branch information
lucataglia and Luca Tagliabue authored Oct 7, 2024
1 parent 5be9eb8 commit f65e093
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const Button = (props: Props): ReactElement<typeof AntdButton> => {
children,
modifier = '',
type,
href,
onClick,
...other
} = props;

const css = classNames({
'm-button--filled': filled,
'm-button--not-clickable': !onClick,
'm-button--not-clickable': !onClick && !href,
});

return (
Expand All @@ -47,6 +48,7 @@ const Button = (props: Props): ReactElement<typeof AntdButton> => {
// TODO Miguel: other types such as secondary-light does not exist on Antd button
type={type as ButtonProps['type']}
onClick={onClick}
href={href}
{...other}
>
{prefix && <span className="m-button--prefix">{prefix}</span>}
Expand Down

0 comments on commit f65e093

Please sign in to comment.