1- import React , { AnchorHTMLAttributes , ButtonHTMLAttributes } from 'react' ;
1+ import React , { ButtonHTMLAttributes , DetailedHTMLProps } from 'react' ;
22import Loading from '../Loading' ;
33import * as S from './styles' ;
44
5- type ButtonDefaultHTMLTypes =
6- | Pick < ButtonHTMLAttributes < HTMLButtonElement > , 'className' >
7- | Pick < AnchorHTMLAttributes < HTMLAnchorElement > , 'target' | 'href' > ;
8-
95type ButtonSizesType = 'small' | 'regular' | 'large' ;
106
117type ButtonVariantsType =
@@ -32,14 +28,6 @@ export type ButtonProps = {
3228 * In the case of the button, have the maximum size of the container
3329 */
3430 isFullWidth ?: boolean ;
35- /**
36- * Optional click handler
37- */
38- onClick ?: ( event ?: React . MouseEvent < HTMLButtonElement > ) => void ;
39- /**
40- * Disabled state of button
41- */
42- disabled ?: boolean ;
4331 /**
4432 * Set the loading status of button
4533 */
@@ -48,7 +36,10 @@ export type ButtonProps = {
4836 * Change component to another element type
4937 */
5038 as ?: React . ElementType ;
51- } & ButtonDefaultHTMLTypes ;
39+ } & DetailedHTMLProps <
40+ ButtonHTMLAttributes < HTMLButtonElement > ,
41+ HTMLButtonElement
42+ > ;
5243
5344/**
5445 * API documentation for the React Button component. Learn about the available props, and the CSS API.
@@ -60,7 +51,6 @@ export const Button = ({
6051 size = 'regular' ,
6152 disabled = false ,
6253 loading = false ,
63- onClick,
6454 ...props
6555} : ButtonProps ) => {
6656 return (
@@ -69,7 +59,6 @@ export const Button = ({
6959 size = { size }
7060 isFullWidth = { isFullWidth }
7161 disabled = { disabled || loading }
72- onClick = { onClick }
7362 { ...props }
7463 >
7564 { loading && < Loading /> }
0 commit comments