mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
9ef1920fe0
* Align footer to bottom * Fix request payment offset padding * Update request payment padding * Add new Input and Dropdown components * Fix offset margins in equiv vals * Update all send tx inputs & dropdowns * Update generate wallet dropdowns * Update inputs & dropdowns for contracts tab * Add inputs & dropdowns for all but swap tab * amend * Fix imports * inputs are invalid when not disabled or readonly * Fix offset refresh button * Add togglable password back to wallet generation * Update swap inputs, textareas, and dropdowns * Update any outstanding inputs * Make UnitDropDown searchable * unitdropdown searchanble if options > 10 * Fix css issues * Reset before setting currentTo
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import React, { Component } from 'react';
|
|
import Spinner from './Spinner';
|
|
import './SimpleButton.scss';
|
|
|
|
const DEFAULT_BUTTON_TYPE = 'primary';
|
|
const DEFAULT_BUTTON_SIZE = 'lg';
|
|
|
|
type ButtonType = 'default' | 'primary' | 'success' | 'info' | 'warning' | 'danger';
|
|
type ButtonSize = 'lg' | 'sm' | 'xs';
|
|
|
|
interface Props {
|
|
text: React.ReactElement<any> | string;
|
|
loading?: boolean;
|
|
disabled?: boolean;
|
|
loadingText?: string;
|
|
size?: ButtonSize;
|
|
type?: ButtonType;
|
|
onClick(): any;
|
|
}
|
|
|
|
export default class SimpleButton extends Component<Props, {}> {
|
|
public computedClass = () => {
|
|
return `btn btn-${this.props.size || DEFAULT_BUTTON_TYPE} btn-${this.props.type ||
|
|
DEFAULT_BUTTON_SIZE}`;
|
|
};
|
|
|
|
public render() {
|
|
const { loading, disabled, loadingText, text, onClick } = this.props;
|
|
return (
|
|
<div>
|
|
<button onClick={onClick} disabled={loading || disabled} className={this.computedClass()}>
|
|
{loading ? (
|
|
<div className="SimpleButton">
|
|
<Spinner light={true} /> {loadingText || text}
|
|
</div>
|
|
) : (
|
|
<div>{text}</div>
|
|
)}
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
}
|