ghost-portal/packages/ui-app/src/Button/Button.tsx
Jaco Greeff 653c2a505f
Basic info display for 123-code (#641)
* Add withCalls

* withCalls operational

* Basic header display & cleanups

* Global account selector for app

* Remove errant debug log

* Simple transfer applet working

* Update Upgrade.tsx

* Update InputNumber.tsx

* Update Transfer.tsx

* Move TxButton back to 123code (for the time being)

* Good enough for a v1
2019-01-27 12:50:47 +01:00

44 lines
1.2 KiB
TypeScript

// Copyright 2017-2019 @polkadot/ui-app authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ButtonProps } from './types';
import React from 'react';
import SUIButton from 'semantic-ui-react/dist/commonjs/elements/Button/Button';
import { isUndefined } from '@polkadot/util';
export default class Button extends React.PureComponent<ButtonProps> {
render () {
const { children, className, floated, icon, isBasic = false, isCircular = false, isDisabled = false, isNegative = false, isPositive = false, isPrimary = false, label, onClick, size, style, tabIndex } = this.props;
const props = {
basic: isBasic || false,
circular: isCircular,
className,
disabled: isDisabled,
floated,
icon,
negative: isNegative,
onClick,
positive: isPositive,
primary: isPrimary,
size,
secondary: isBasic && !(isPositive || isPrimary || isNegative || false),
style,
tabIndex
};
return isUndefined(label) && isUndefined(children)
? (
<SUIButton {...props} />
)
: (
<SUIButton {...props}>
{label}{children}
</SUIButton>
);
}
}