New source found from dndbeyond.com
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { MouseEvent, PureComponent, PropsWithChildren } from "react";
|
||||
|
||||
export interface ButtonProps {
|
||||
export interface ButtonProps extends PropsWithChildren {
|
||||
onClick?: ((evt: React.MouseEvent) => void) | (() => void);
|
||||
clsNames?: Array<string>;
|
||||
className: string;
|
||||
@@ -24,7 +24,7 @@ interface ButtonState {
|
||||
currentDuration: number;
|
||||
confirmText: string;
|
||||
}
|
||||
export class Button extends React.PureComponent<ButtonProps, ButtonState> {
|
||||
export class Button extends PureComponent<ButtonProps, ButtonState> {
|
||||
static defaultProps = {
|
||||
className: "",
|
||||
styledDisabled: false,
|
||||
@@ -56,7 +56,7 @@ export class Button extends React.PureComponent<ButtonProps, ButtonState> {
|
||||
clearInterval(this.confirmIntervalId);
|
||||
}
|
||||
|
||||
handleConfirmClick = (evt: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
handleConfirmClick = (evt: MouseEvent<HTMLButtonElement>): void => {
|
||||
const { isConfirming, isConfirmed } = this.state;
|
||||
const {
|
||||
confirmText,
|
||||
@@ -120,7 +120,7 @@ export class Button extends React.PureComponent<ButtonProps, ButtonState> {
|
||||
}
|
||||
};
|
||||
|
||||
handleClick = (evt: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
handleClick = (evt: MouseEvent<HTMLButtonElement>): void => {
|
||||
const { onClick, stopPropagation, isInteractive } = this.props;
|
||||
|
||||
if (onClick && isInteractive) {
|
||||
@@ -229,10 +229,10 @@ export class Button extends React.PureComponent<ButtonProps, ButtonState> {
|
||||
>
|
||||
<span className="ct-button__content">{children}</span>
|
||||
{enableConfirm && (
|
||||
<React.Fragment>
|
||||
<>
|
||||
<span className="ct-button__confirming">{confirmText}</span>
|
||||
<span className="ct-button__confirmed" />
|
||||
</React.Fragment>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user