mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
remove test download button
This commit is contained in:
@@ -5,22 +5,39 @@ interface IProps {
|
||||
children: React.ReactNode;
|
||||
onClick: () => any;
|
||||
id: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export default class BigButton extends React.Component<IProps, never> {
|
||||
interface IState {
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export default class BigButton extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
disabled: this.props.disabled
|
||||
}
|
||||
|
||||
this.handleClick = this.handleClick.bind(this)
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props: IProps, state: IState) {
|
||||
return {
|
||||
disabled: props.disabled
|
||||
}
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
if (this.state.disabled) return
|
||||
|
||||
this.props.onClick()
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="BigButton" onClick={this.handleClick} id={this.props.id}>
|
||||
<div className={'BigButton ' + (this.state.disabled ? 'disabled' : '')} onClick={this.handleClick} id={this.props.id}>
|
||||
<div className="BigButtonText">{this.props.children}</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user