Remove unused Button props (#3267)

* Remove unused Button props

* Bump deps
This commit is contained in:
Jaco Greeff 2020-07-25 15:30:40 +02:00 committed by GitHub
parent 4ba5863deb
commit 9003d32c85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 95 additions and 193 deletions

View File

@ -33,10 +33,10 @@
"afterSign": "electron-builder-notarize"
},
"resolutions": {
"@polkadot/api": "^1.26.0-beta.1",
"@polkadot/api-contract": "^1.26.0-beta.1",
"@polkadot/api": "^1.26.0-beta.2",
"@polkadot/api-contract": "^1.26.0-beta.2",
"@polkadot/keyring": "^3.0.0-beta.3",
"@polkadot/types": "^1.26.0-beta.1",
"@polkadot/types": "^1.26.0-beta.2",
"@polkadot/util": "^3.0.0-beta.3",
"@polkadot/util-crypto": "^3.0.0-beta.3",
"@polkadot/wasm-crypto": "^1.2.1",

View File

@ -85,7 +85,6 @@ function Backup ({ address, onClose }: Props): React.ReactElement<Props> {
icon='download'
isBusy={isBusy}
isDisabled={!isPassValid}
isPrimary
label={t<string>('Download')}
onClick={_doBackup}
/>

View File

@ -134,7 +134,6 @@ function ChangePass ({ address, className = '', onClose }: Props): React.ReactEl
icon='sign-in-alt'
isBusy={isBusy}
isDisabled={!newPass1.isValid || !newPass2.isValid || !isOldValid}
isPrimary
label={t<string>('Change')}
onClick={_doChange}
/>

View File

@ -363,7 +363,6 @@ function Create ({ className = '', onClose, onStatusChange, seed: propsSeed, typ
icon='plus'
isBusy={isBusy}
isDisabled={!isValid}
isPrimary
label={t<string>('Save')}
onClick={toggleConfirmation}
/>

View File

@ -35,7 +35,6 @@ function CreateConfirmation ({ address, isBusy, name, onClose, onCommit }: Props
<Button
icon='plus'
isBusy={isBusy}
isPrimary
label={t<string>('Create and backup account')}
onClick={onCommit}
/>

View File

@ -107,7 +107,6 @@ function Delegate ({ onClose, previousAmount, previousConviction, previousDelega
<TxButton
accountId={delegatingAccount}
icon='trash-alt'
isNegative
label={t<string>('Undelegate')}
onStart={onClose}
params={[]}
@ -118,7 +117,6 @@ function Delegate ({ onClose, previousAmount, previousConviction, previousDelega
accountId={delegatingAccount}
icon='sign-in-alt'
isDisabled={!amount?.gt(BN_ZERO) || !!amountError?.error || !isDirty}
isPrimary
label={previousDelegatedAccount
? t<string>('Save delegation')
: t<string>('Delegate')

View File

@ -258,7 +258,6 @@ function Derive ({ className = '', from, onClose }: Props): React.ReactElement {
icon='lock'
isBusy={isBusy}
isDisabled={!isRootValid}
isPrimary
label={t<string>('Unlock')}
onClick={_onUnlock}
/>
@ -268,7 +267,6 @@ function Derive ({ className = '', from, onClose }: Props): React.ReactElement {
icon='plus'
isBusy={isBusy}
isDisabled={!isValid}
isPrimary
label={t<string>('Save')}
onClick={toggleConfirmation}
/>

View File

@ -233,7 +233,6 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React
<TxButton
accountId={address}
isDisabled={!okAll}
isPrimary
label={t<string>('Set Identity')}
onStart={onClose}
params={[info]}

View File

@ -145,14 +145,12 @@ function IdentitySubModal ({ address, className, onClose }: Props): React.ReactE
<Button.Group>
<Button
icon='plus'
isPrimary
label={t<string>('Add sub')}
onClick={_rowAdd}
/>
<Button
icon='minus'
isDisabled={infos.length === 0}
isNegative
label={t<string>('Remove sub')}
onClick={_rowRemove}
/>
@ -166,7 +164,6 @@ function IdentitySubModal ({ address, className, onClose }: Props): React.ReactE
<TxButton
accountId={address}
isDisabled={infos.some(([address, raw]) => !address || !raw)}
isPrimary
label={t<string>('Set Subs')}
onStart={onClose}
params={[

View File

@ -160,7 +160,6 @@ function Import ({ className = '', onClose, onStatusChange }: Props): React.Reac
icon='sync'
isBusy={isBusy}
isDisabled={!isFileValid || !isPassValid}
isPrimary
label={t<string>('Restore')}
onClick={_onSave}
/>

View File

@ -138,7 +138,6 @@ function Multisig ({ className = '', onClose, onStatusChange }: Props): React.Re
<Button
icon='plus'
isDisabled={!isValid}
isPrimary
label={t<string>('Create')}
onClick={_createMultisig}
/>

View File

@ -112,7 +112,6 @@ function ProxyAdd ({ className = '', onClose, onStatusChange }: Props): React.Re
<Button
icon='plus'
isDisabled={!isValid}
isPrimary
label={t<string>('Add')}
onClick={_createProxied}
/>

View File

@ -162,7 +162,6 @@ function QrModal ({ className = '', onClose, onStatusChange }: Props): React.Rea
<Button
icon='sign-in-alt'
isDisabled={!scanned || !isValid || (isAddress && isIpfs)}
isPrimary
label={t<string>('Create')}
onClick={_onSave}
/>

View File

@ -110,7 +110,6 @@ function Transfer ({ className = '', onClose, recipientId: propRecipientId, send
accountId={senderId}
icon='paper-plane'
isDisabled={!hasAvailable || !recipientId || !amount}
isPrimary
label={t<string>('Make Transfer')}
onStart={onClose}
params={[recipientId, amount]}

View File

@ -39,7 +39,6 @@ function Undelegate ({ accountDelegating, onClose }: Props): React.ReactElement<
<TxButton
accountId={accountDelegating}
icon='sign-in-alt'
isPrimary
label={t<string>('Undelegate')}
onStart={onClose}
params={[]}

View File

@ -131,7 +131,6 @@ function Create ({ onClose, onStatusChange }: Props): React.ReactElement<Props>
<Button
icon='save'
isDisabled={!isValid}
isPrimary
label={t<string>('Save')}
onClick={_onCommit}
/>

View File

@ -25,7 +25,6 @@ interface Props {
function Sidebar ({ address, className = '', onClose, onUpdateName }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { accountIndex, flags, identity, isEditingName, isEditingTags, meta, name, onForgetAddress, onSaveName, onSaveTags, setName, setTags, tags, toggleIsEditingName, toggleIsEditingTags } = useAccountInfo(address);
const [isHoveringButton, toggleIsHoveringButton] = useToggle();
const [isTransferOpen, toggleIsTransferOpen] = useToggle();
const _onForgetAddress = useCallback(
@ -118,30 +117,21 @@ function Sidebar ({ address, className = '', onClose, onUpdateName }: Props): Re
icon='check'
isBasic
label={t<string>('Owned')}
onMouseEnter={toggleIsHoveringButton}
onMouseLeave={toggleIsHoveringButton}
/>
)}
{!flags.isOwned && !flags.isInContacts && (
<Button
icon='plus'
isPositive
label={t<string>('Save')}
onClick={_onUpdateName}
onMouseEnter={toggleIsHoveringButton}
onMouseLeave={toggleIsHoveringButton}
/>
)}
{!flags.isOwned && flags.isInContacts && (
<Button
className='ui--AddressMenu-button'
icon='ban'
isNegative={isHoveringButton}
isPositive={!isHoveringButton}
label={t<string>('Remove')}
onClick={_onForgetAddress}
onMouseEnter={toggleIsHoveringButton}
onMouseLeave={toggleIsHoveringButton}
/>
)}
</Button.Group>

View File

@ -53,12 +53,10 @@ function Match ({ address, className = '', count, offset, onCreateToggle, onRemo
<td className='button'>
<Button
icon='plus'
isPrimary
onClick={_onCreate}
/>
<Button
icon='times'
isNegative
onClick={_onRemove}
/>
</td>

View File

@ -90,7 +90,6 @@ function Attest ({ accountId, className, ethereumAddress, onSuccess, statementKi
accountId={accountId}
icon='paper-plane'
isDisabled={!statementSentence}
isPrimary
label={t<string>('I agree')}
onSuccess={onSuccess}
params={[statementSentence]}

View File

@ -87,7 +87,6 @@ function Claim ({ accountId, className = '', ethereumAddress, ethereumSignature,
<Button.Group>
<TxButton
icon='paper-plane'
isPrimary
isUnsigned
label={t('Claim')}
onSuccess={onSuccess}

View File

@ -12,6 +12,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/api-contract": "^1.26.0-beta.1"
"@polkadot/api-contract": "^1.26.0-beta.2"
}
}

View File

@ -93,7 +93,6 @@ function Add (): React.ReactElement {
<Button
icon='save'
isDisabled={!isValid}
isPrimary
label={t('Save')}
onClick={_onSave}
/>

View File

@ -75,13 +75,11 @@ function Code ({ className, code, onShowDeploy }: Props): React.ReactElement<Pro
<>
<Button
icon='trash'
isNegative
onClick={toggleIsForgetOpen}
tooltip={t('Forget this code hash')}
/>
<Button
icon='upload'
isPrimary
label={t('deploy')}
onClick={_onShowDeploy}
tooltip={t('Deploy this code hash as a smart contract')}

View File

@ -117,7 +117,6 @@ function Add (): React.ReactElement {
<Button
icon='save'
isDisabled={!isValid}
isPrimary
label={t<string>('Save')}
onClick={_onAdd}
/>

View File

@ -205,7 +205,6 @@ function Call (props: Props): React.ReactElement<Props> | null {
<Button
icon='sign-in-alt'
isDisabled={!isValid}
isPrimary
label={t<string>('Call')}
onClick={_onSubmitRpc}
/>
@ -215,7 +214,6 @@ function Call (props: Props): React.ReactElement<Props> | null {
accountId={accountId}
icon='sign-in-alt'
isDisabled={!isValid}
isPrimary
label={t('Call')}
onClick={(): void => setIsBusy(true)}
onFailed={(): void => setIsBusy(false)}

View File

@ -69,13 +69,11 @@ function Contract ({ className, contract: { abi, address }, onCall }: Props): Re
<div className='contracts--Contract-buttons'>
<Button
icon='trash'
isNegative
onClick={toggleIsForgetOpen}
tooltip={t<string>('Forget this contract')}
/>
<Button
icon='play'
isPrimary
label={t<string>('execute')}
onClick={onCall()}
tooltip={t<string>('Call a method on this contract')}

View File

@ -40,7 +40,6 @@ function Outcome ({ className = '', onClear, outcome: { isSuccess, message, orig
<Button
className='icon-button clear-btn'
icon='times'
isPrimary
onClick={onClear}
/>
</div>

View File

@ -227,7 +227,6 @@ function Deploy ({ allCodes, basePath, codeHash, constructorIndex = 0, isOpen, o
accountId={accountId}
icon='upload'
isDisabled={!isValid}
isPrimary
label={t('Deploy')}
onClick={onClose}
onSuccess={_onSuccess}

View File

@ -45,7 +45,6 @@ function RemoveABI ({ code, onClose, onRemove }: Props): React.ReactElement<Prop
<Modal.Actions onCancel={onClose}>
<Button
icon='trash'
isPrimary
label={t<string>('Remove')}
onClick={_onRemove}
/>

View File

@ -107,7 +107,6 @@ function ProposeExternal ({ className = '', isMember, members }: Props): React.R
accountId={accountId}
icon='plus'
isDisabled={!threshold || !members.includes(accountId || '') || !proposal}
isPrimary
label={t<string>('Propose')}
onStart={toggleVisible}
params={

View File

@ -119,7 +119,6 @@ function Slashing ({ className = '', isMember, members }: Props): React.ReactEle
accountId={accountId}
icon='repeat'
isDisabled={!threshold || !members.includes(accountId || '') || !proposal}
isPrimary
label={t<string>('Revert')}
onStart={toggleVisible}
params={[threshold, proposal]}

View File

@ -94,7 +94,6 @@ function Fasttrack ({ imageHash, threshold }: Props): React.ReactElement<Props>
accountId={accountId}
icon='fast-forward'
isDisabled={!accountId || !proposal || !memberThreshold}
isPrimary
label={t<string>('Fast track')}
onStart={toggleFasttrack}
params={

View File

@ -120,7 +120,6 @@ function PreImage ({ className = '', imageHash, isImminent = false, onClose }: P
accountId={accountId}
icon='plus'
isDisabled={!proposal || !accountId || !isMatched || !encodedProposal}
isPrimary
label={t<string>('Submit preimage')}
onStart={onClose}
params={[encodedProposal]}

View File

@ -101,7 +101,6 @@ function Propose ({ className = '', onClose }: Props): React.ReactElement<Props>
accountId={accountId}
icon='plus'
isDisabled={!balance || !hasMinLocked || !isHashValid || !accountId}
isPrimary
label={t<string>('Submit proposal')}
onStart={onClose}
params={[hash, balance]}

View File

@ -71,7 +71,6 @@ function Seconding ({ depositors, image, proposalId }: Props): React.ReactElemen
accountId={accountId}
icon='sign-in-alt'
isDisabled={!accountId || isDepositor}
isPrimary
label={t<string>('Second')}
onStart={toggleSeconding}
params={

View File

@ -65,7 +65,6 @@ function Selection (): React.ReactElement {
extrinsic={extrinsic}
icon='sign-in-alt'
isDisabled={!extrinsic || !accountId}
isPrimary={false}
label={t<string>('Submit Transaction')}
/>
</Button.Group>

View File

@ -37,7 +37,6 @@ function AssetCard ({ assetId, className = '', name, onForget, onSaveName }: Pro
buttons={(
<Button
icon='trash'
isNegative
key='forget'
onClick={_onForget}
tooltip={t<string>('Forget this asset')}

View File

@ -116,7 +116,6 @@ function Transfer ({ assets, className = '', onClose, recipientId: propRecipient
accountId={senderId}
extrinsic={extrinsic}
icon='paper-plane'
isPrimary
label={t<string>('Make Transfer')}
onStart={onClose}
/>

View File

@ -56,7 +56,6 @@ function Create ({ onClose, onRegister }: Props): React.ReactElement<Props> {
<Button
icon='registered'
isDisabled={!name}
isPrimary
label={t<string>('Register')}
onClick={onClose}
/>

View File

@ -55,7 +55,6 @@ function ActionButtons ({ className = '', isCustomExample, isRunning, removeSnip
? (
<Button
icon='trash'
isNegative
onClick={removeSnippet}
/>
)

View File

@ -79,7 +79,6 @@ function Parachain ({ basePath, className = '', isMine, paraInfoRef, sudoKey }:
<Button
className='menu-button'
icon='ellipsis-v'
isPrimary
onClick={toggleMenu}
/>
}

View File

@ -142,7 +142,6 @@ function General ({ className = '', isModalContent, onClose }: Props): React.Rea
<Button
icon='save'
isDisabled={changed === null}
isPrimary={isModalContent}
label={
changed
? t<string>('Save & Reload')

View File

@ -55,7 +55,6 @@ function BidNew ({ onClose }: Props): React.ReactElement<Props> {
accountId={accountId}
icon='sign-in-alt'
isDisabled={!amount}
isPrimary
label={t<string>('Bid')}
onStart={onClose}
params={[amount]}

View File

@ -103,7 +103,6 @@ function BondExtra ({ controllerId, onClose, stakingInfo, stashId }: Props): Rea
accountId={stashId}
icon='sign-in-alt'
isDisabled={!maxAdditional?.gt(BN_ZERO) || !!amountError?.error}
isPrimary
label={t<string>('Bond more')}
onStart={onClose}
params={[maxAdditional]}

View File

@ -135,7 +135,6 @@ function InjectKeys ({ onClose }: Props): React.ReactElement<Props> | null {
<Modal.Actions onCancel={onClose}>
<Button
icon='sign-in-alt'
isPrimary
label={t<string>('Submit key')}
onClick={_onSubmit}
/>

View File

@ -48,7 +48,6 @@ function Nominate ({ controllerId, next, nominating, onClose, stashId, targets,
extrinsic={nominateTx}
icon='hand-paper'
isDisabled={!nominateTx}
isPrimary
label={t<string>('Nominate')}
onStart={onClose}
/>

View File

@ -69,7 +69,6 @@ function SetControllerAccount ({ defaultControllerId, onClose, stashId }: Props)
accountId={stashId}
icon='sign-in-alt'
isDisabled={!controllerId || isFatal}
isPrimary
label={t<string>('Set controller')}
onStart={onClose}
params={[controllerId]}

View File

@ -64,7 +64,6 @@ function SetRewardDestination ({ controllerId, defaultDestination, onClose, stas
accountId={controllerId}
icon='sign-in-alt'
isDisabled={!controllerId}
isPrimary
label={t<string>('Set reward destination')}
onStart={onClose}
params={[destination]}

View File

@ -39,7 +39,6 @@ function SetSessionKey ({ controllerId, onClose, stashId }: Props): React.ReactE
extrinsic={sessionTx}
icon='sign-in-alt'
isDisabled={!sessionTx}
isPrimary
label={t<string>('Set Session Key')}
onStart={onClose}
/>

View File

@ -86,7 +86,6 @@ function Unbond ({ className = '', controllerId, onClose, stakingLedger, stashId
accountId={controllerId}
icon='sign-out'
isDisabled={!maxUnbond?.gtn(0)}
isPrimary
label={t<string>('Unbond')}
onStart={onClose}
params={[maxUnbond]}

View File

@ -39,7 +39,6 @@ function Validate ({ controllerId, onClose, stashId }: Props): React.ReactElemen
extrinsic={validateTx}
icon='certificate'
isDisabled={!validateTx}
isPrimary
label={t<string>('Validate')}
onStart={onClose}
/>

View File

@ -184,7 +184,6 @@ function Account ({ className = '', info: { controllerId, destination, destinati
accountId={controllerId}
icon='stop'
isDisabled={!isOwnController || isDisabled}
isPrimary={false}
key='stop'
label={t<string>('Stop')}
tx='staking.chill'

View File

@ -101,7 +101,6 @@ function NewNominator ({ isInElection, next, targets, validators }: Props): Reac
accountId={stashId}
icon='sign-in-alt'
isDisabled={!bondTx || !nominateTx || !stashId || !controllerId}
isPrimary
label={t<string>('Bond & Nominate')}
onStart={_toggle}
params={[
@ -116,7 +115,6 @@ function NewNominator ({ isInElection, next, targets, validators }: Props): Reac
<Button
icon='step-forward'
isDisabled={!bondTx}
isPrimary
label={t<string>('next')}
onClick={_nextStep}
/>

View File

@ -46,7 +46,6 @@ function NewStash (): React.ReactElement {
extrinsic={bondTx}
icon='sign-in-alt'
isDisabled={!bondTx || !stashId}
isPrimary
label={t<string>('Bond')}
onStart={_toggle}
/>

View File

@ -102,7 +102,6 @@ function NewValidator ({ isInElection }: Props): React.ReactElement<Props> {
accountId={stashId}
icon='sign-in-alt'
isDisabled={!bondTx || !sessionTx || !validateTx}
isPrimary
label={t<string>('Bond & Validate')}
onStart={_toggle}
params={[
@ -117,7 +116,6 @@ function NewValidator ({ isInElection }: Props): React.ReactElement<Props> {
<Button
icon='step-forward'
isDisabled={!bondTx}
isPrimary
label={t<string>('next')}
onClick={_nextStep}
/>

View File

@ -97,7 +97,6 @@ function Stash ({ className = '', isDisabled, payout: { available, rewards, stas
extrinsic={extrinsic}
icon='credit-card'
isDisabled={!extrinsic || isDisabled}
isPrimary={false}
label={t<string>('Payout')}
/>
)}

View File

@ -212,7 +212,6 @@ function Query ({ className = '', onRemove, value }: Props): React.ReactElement<
)}
<Button
icon='times'
isNegative
key='close'
onClick={_onRemove}
/>

View File

@ -48,7 +48,6 @@ function Consts ({ onAdd }: Props): React.ReactElement<Props> {
<div className='storage--actionrow-buttons'>
<Button
icon='plus'
isPrimary
onClick={_onAdd}
/>
</div>

View File

@ -48,7 +48,6 @@ function Raw ({ onAdd }: Props): React.ReactElement<Props> {
<Button
icon='plus'
isDisabled={!isValid}
isPrimary
onClick={_onAdd}
/>
</div>

View File

@ -47,7 +47,6 @@ function SetKey ({ allAccounts, className = '', isMine, sudoKey }: Props): React
accountId={sudoKey}
icon='sign-in-alt'
isDisabled={!isMine || sudoKey === selected}
isPrimary
label={t<string>('Reassign')}
params={[selected]}
tx='sudo.setKey'

View File

@ -98,7 +98,6 @@ function Unlock ({ onClose, onUnlock, pair }: Props): React.ReactElement<Props>
<Button
icon='unlock'
isBusy={isBusy}
isPrimary
label={t<string>('Unlock')}
onClick={_onUnlock}
/>

View File

@ -94,7 +94,6 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {
accountId={accountId}
icon='plus'
isDisabled={!accountId || !hasValue}
isPrimary
label={t<string>('Submit proposal')}
onStart={toggleOpen}
params={[value, beneficiary]}

View File

@ -105,7 +105,6 @@ function Submission ({ councilProposals, id, isDisabled, members }: Props): Reac
accountId={accountId}
icon='check'
isDisabled={!accountId || !councilThreshold}
isPrimary
label={t<string>('Send to council')}
onStart={toggleOpen}
params={

View File

@ -53,7 +53,6 @@ function TipClose ({ hash, isMember, members }: Props): React.ReactElement<Props
<TxButton
accountId={accountId}
isDisabled={!accountId}
isPrimary
onStart={toggleOpen}
params={[hash]}
tx='treasury.closeTip'

View File

@ -111,7 +111,6 @@ function TipCreate ({ members, refresh }: Props): React.ReactElement<Props> {
accountId={accountId}
icon='plus'
isDisabled={!accountId || (isMember ? !hasValue : false) || !hasReason}
isPrimary
label={t<string>('Propose tip')}
onStart={toggleOpen}
onSuccess={refresh}

View File

@ -69,7 +69,6 @@ function TipEndorse ({ hash, isMember, members }: Props): React.ReactElement<Pro
accountId={accountId}
icon='plus'
isDisabled={!accountId}
isPrimary
label={t<string>('Submit tip')}
onStart={toggleOpen}
params={[hash, value]}

View File

@ -31,7 +31,7 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/api": "^1.26.0-beta.1",
"@polkadot/api": "^1.26.0-beta.2",
"@polkadot/extension-dapp": "^0.32.0-beta.9",
"rxjs-compat": "^6.6.0"
}

View File

@ -10,8 +10,7 @@ import styled from 'styled-components';
import Icon from '../Icon';
import Spinner from '../Spinner';
// isPrimary, isPosition, isNegative - here for old compat, check, remove
function Button ({ children, className = '', icon, isBasic, isBusy, isCircular, isDisabled, isFull, isIcon, isNegative, isPositive, isPrimary, label, onClick, onMouseEnter, onMouseLeave, tabIndex }: ButtonProps): React.ReactElement<ButtonProps> {
function Button ({ children, className = '', icon, isBasic, isBusy, isCircular, isDisabled, isFull, isIcon, label, onClick, onMouseEnter, onMouseLeave, tabIndex }: ButtonProps): React.ReactElement<ButtonProps> {
const _onClick = useCallback(
() => !(isBusy || isDisabled) && onClick && onClick(),
[isBusy, isDisabled, onClick]
@ -19,7 +18,7 @@ function Button ({ children, className = '', icon, isBasic, isBusy, isCircular,
return (
<button
className={`ui--Button${label ? ' hasLabel' : ''}${isBasic ? ' isBasic' : ''}${isCircular ? ' isCircular' : ''}${isFull ? ' isFull' : ''}${isIcon ? ' isIcon' : ''}${isNegative ? ' isNegative' : ''}${isPositive ? ' isPositive' : ''}${isPrimary ? ' isPrimary' : ''}${(isBusy || isDisabled) ? ' isDisabled' : ''}${isBusy ? ' isBusy' : ''}${!onClick ? ' isReadOnly' : ''} ${className}`}
className={`ui--Button${label ? ' hasLabel' : ''}${isBasic ? ' isBasic' : ''}${isCircular ? ' isCircular' : ''}${isFull ? ' isFull' : ''}${isIcon ? ' isIcon' : ''}${(isBusy || isDisabled) ? ' isDisabled' : ''}${isBusy ? ' isBusy' : ''}${!onClick ? ' isReadOnly' : ''} ${className}`}
onClick={_onClick}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
@ -36,18 +35,26 @@ function Button ({ children, className = '', icon, isBasic, isBusy, isCircular,
);
}
const ICON_PADDING = 0.5;
export default React.memo(styled(Button)`
background: transparent; // #e9e8e7; // similar to rgba(0, 0, 0, 0.05);
background: transparent;
border: none;
color: #4e4e4e;
color: inherit;
cursor: pointer;
// font-size: 0.92857142857rem; // 13/14px
line-height: 1;
margin: 0;
position: relative;
vertical-align: middle;
text-align: center;
&:not(.hasLabel) {
padding: 0.7em 0.4rem;
padding: 0.7em;
.ui--Icon {
padding: 0.6rem;
margin: -0.6rem;
}
}
&:not(.isCircular) {
@ -59,7 +66,7 @@ export default React.memo(styled(Button)`
}
&.hasLabel {
padding: 0.7rem 1.15rem 0.7rem ${1.15 - 0.425}rem;
padding: 0.7rem 1.1rem 0.7rem ${1.1 - ICON_PADDING}rem;
.ui--Icon {
margin-right: 0.425rem !important;
@ -108,11 +115,11 @@ export default React.memo(styled(Button)`
}
.ui--Icon {
border-radius: 1rem;
border-radius: 50%;
box-sizing: content-box;
height: 1rem;
margin: -0.425rem 0;
padding: 0.425rem;
margin: -${ICON_PADDING}rem 0;
padding: ${ICON_PADDING}rem;
width: 1rem;
}

View File

@ -17,9 +17,6 @@ export interface ButtonProps {
isDisabled?: boolean;
isFull?: boolean;
isIcon?: boolean;
isNegative?: boolean;
isPositive?: boolean;
isPrimary?: boolean;
label?: React.ReactNode;
onClick?: Button$Callback;
onMouseEnter?: Button$Callback;

View File

@ -23,7 +23,6 @@ function ButtonCancel ({ className = '', isDisabled, label, onClick, tabIndex }:
className={className}
icon='times'
isDisabled={isDisabled}
isNegative
label={label || t<string>('Cancel')}
onClick={onClick}
tabIndex={tabIndex}

View File

@ -48,7 +48,6 @@ function CopyButton ({ children, className, icon = 'copy', isAddress = false, va
<Button
className='icon-button show-on-hover'
icon={icon}
isPrimary
/>
</span>
</div>

View File

@ -29,7 +29,6 @@ function EditButton ({ children, className, icon = 'edit', onClick }: Props): Re
<Icon
className='icon-button'
icon={icon}
isPrimary
/>
</span>
</div>

View File

@ -93,7 +93,6 @@ function Forget (props: Props): React.ReactElement<Props> {
<Modal.Actions onCancel={onClose}>
<Button
icon='trash'
isPrimary
label={t<string>('Forget')}
onClick={onForget}
/>

View File

@ -8,13 +8,13 @@ import { TxButtonProps as Props } from './types';
import React, { useCallback, useContext } from 'react';
import { SubmittableResult } from '@polkadot/api';
import { useApi, useToggle } from '@polkadot/react-hooks';
import { assert, isFunction, isUndefined } from '@polkadot/util';
import { assert, isFunction } from '@polkadot/util';
import Button from './Button';
import { StatusContext } from './Status';
import { useTranslation } from './translate';
function TxButton ({ accountId, className = '', extrinsic: propsExtrinsic, icon, isBasic, isBusy, isDisabled, isIcon, isNegative, isPrimary, isUnsigned, label, onClick, onFailed, onSendRef, onStart, onSuccess, onUpdate, params, tooltip, tx, withSpinner }: Props): React.ReactElement<Props> {
function TxButton ({ accountId, className = '', extrinsic: propsExtrinsic, icon, isBasic, isBusy, isDisabled, isIcon, isUnsigned, label, onClick, onFailed, onSendRef, onStart, onSuccess, onUpdate, params, tooltip, tx, withSpinner }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { queueExtrinsic } = useContext(StatusContext);
@ -90,12 +90,6 @@ function TxButton ({ accountId, className = '', extrinsic: propsExtrinsic, icon,
isBusy={isBusy}
isDisabled={isSending || isDisabled || needsAccount}
isIcon={isIcon}
isNegative={isNegative}
isPrimary={
isUndefined(isPrimary) && isUndefined(isIcon)
? (!isNegative && !isBasic)
: isPrimary
}
label={label || (isIcon ? '' : t<string>('Submit'))}
onClick={_onSend}
tooltip={tooltip}

View File

@ -151,7 +151,6 @@ export default class TxModal<P extends TxModalProps, S extends TxModalState> ext
)}
icon='sign-in-alt'
isDisabled={this.isDisabled()}
isPrimary
label={this.submitLabel()}
onClick={this.onSubmit}
onFailed={this.onFailed}

View File

@ -116,7 +116,6 @@ function TxModal<P extends Props> ({
<Button
icon={submitButtonIcon}
isDisabled={isDisabled || isSending || !accountId || !isSubmittable}
isPrimary
label={submitButtonLabel}
onClick={onSend}
{...submitButtonProps}

View File

@ -30,7 +30,6 @@ function VoteActions ({ accountId, aye, className = '', isDisabled, onClick, par
accountId={accountId}
icon='check'
isDisabled={!accountId || isDisabled}
isPrimary
label={aye
? t<string>('Vote Aye')
: t<string>('Vote Nay')}

View File

@ -60,8 +60,6 @@ export interface TxButtonProps extends TxProps {
isBusy?: boolean;
isDisabled?: boolean;
isIcon?: boolean;
isNegative?: boolean;
isPrimary?: boolean;
isUnsigned?: boolean;
label?: React.ReactNode;
onClick?: VoidFn;

View File

@ -100,14 +100,12 @@ function Vector ({ className = '', defaultValue, isDisabled = false, label, onCh
<div className='ui--Param-Vector-buttons'>
<Button
icon='plus'
isPrimary
label={t<string>('Add item')}
onClick={_rowAdd}
/>
<Button
icon='minus'
isDisabled={values.length === 0}
isNegative
label={t<string>('Remove item')}
onClick={_rowRemove}
/>

View File

@ -345,7 +345,6 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea
}
isBusy={isBusy}
isDisabled={!senderInfo.signAddress || isRenderError}
isPrimary
label={
flags.isQr
? t<string>('Sign via Qr')

View File

@ -74,7 +74,6 @@ function TxUnsigned ({ className, currentItem }: Props): React.ReactElement<Prop
<Button
icon='sign-in-alt'
isDisabled={isRenderError}
isPrimary
label={t('Submit (no signature)')}
onClick={_onSend}
tabIndex={2}

140
yarn.lock
View File

@ -2952,57 +2952,57 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/api-contract@npm:^1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/api-contract@npm:1.26.0-beta.1"
"@polkadot/api-contract@npm:^1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/api-contract@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/api": 1.26.0-beta.1
"@polkadot/rpc-core": 1.26.0-beta.1
"@polkadot/types": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/api": 1.26.0-beta.2
"@polkadot/rpc-core": 1.26.0-beta.2
"@polkadot/types": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
bn.js: ^5.1.2
rxjs: ^6.6.0
checksum: 3/c41e6ee4438796bfc280e26851534982eda749ff4fbc728ab2c5b1d82abf9d4744f662dd559bb787383c07a4a34445b1eea5a83abc65a74777bc950f46e9f9c2
checksum: 3/f3b7e50c2aa06e33c4c889ce28a1bec644995f857cf3cd86be66dcabe9d30d3098ae645933b868c5dd613dacc8be213bf119ff2ed9d3e1e8b0f7e7f8930a66f9
languageName: node
linkType: hard
"@polkadot/api-derive@npm:1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/api-derive@npm:1.26.0-beta.1"
"@polkadot/api-derive@npm:1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/api-derive@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/api": 1.26.0-beta.1
"@polkadot/rpc-core": 1.26.0-beta.1
"@polkadot/rpc-provider": 1.26.0-beta.1
"@polkadot/types": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/util-crypto": ^2.18.1
"@polkadot/api": 1.26.0-beta.2
"@polkadot/rpc-core": 1.26.0-beta.2
"@polkadot/rpc-provider": 1.26.0-beta.2
"@polkadot/types": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
"@polkadot/util-crypto": ^3.0.0-beta.3
bn.js: ^5.1.2
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/0948b9ce0476b677f27cb81271d7d28e02a0d694ec9c05b49640184108c74c3ff77404f4d745f2f151723c31260bbf2de3fec8e05a982609f09f9161583405fc
checksum: 3/f0d89188fbe3c085f5f8ab7030b8340ecf46adafcefe1bef919f7f992bcd4f23a985d6cc35539573aec12c27f9f1d689fb189ef33efdca7153dc65f021192bb2
languageName: node
linkType: hard
"@polkadot/api@npm:^1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/api@npm:1.26.0-beta.1"
"@polkadot/api@npm:^1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/api@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/api-derive": 1.26.0-beta.1
"@polkadot/keyring": ^2.18.1
"@polkadot/metadata": 1.26.0-beta.1
"@polkadot/rpc-core": 1.26.0-beta.1
"@polkadot/rpc-provider": 1.26.0-beta.1
"@polkadot/types": 1.26.0-beta.1
"@polkadot/types-known": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/util-crypto": ^2.18.1
"@polkadot/api-derive": 1.26.0-beta.2
"@polkadot/keyring": ^3.0.0-beta.3
"@polkadot/metadata": 1.26.0-beta.2
"@polkadot/rpc-core": 1.26.0-beta.2
"@polkadot/rpc-provider": 1.26.0-beta.2
"@polkadot/types": 1.26.0-beta.2
"@polkadot/types-known": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
"@polkadot/util-crypto": ^3.0.0-beta.3
bn.js: ^5.1.2
eventemitter3: ^4.0.4
rxjs: ^6.6.0
checksum: 3/8c9aeaf0430d370c9f303f775692ba2bf478f68c03971e01f86a28d0cdf23164e5ca92d447146c8677cf4c201cf81b09caa0ea0c5e25790f32e2b36a79e38fb1
checksum: 3/2baafc4ac071f35de71b34d3bd96e05554d6cbd6b2f44db5c12bdcc2d13bca2387feb173c143a08fbf256f9d581b256e9d0bf16ef4aac918ed5c19a8d4c60b83
languageName: node
linkType: hard
@ -3033,7 +3033,7 @@ __metadata:
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/api-contract": ^1.26.0-beta.1
"@polkadot/api-contract": ^1.26.0-beta.2
languageName: unknown
linkType: soft
@ -3399,17 +3399,17 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/metadata@npm:1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/metadata@npm:1.26.0-beta.1"
"@polkadot/metadata@npm:1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/metadata@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/types": 1.26.0-beta.1
"@polkadot/types-known": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/util-crypto": ^2.18.1
"@polkadot/types": 1.26.0-beta.2
"@polkadot/types-known": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
"@polkadot/util-crypto": ^3.0.0-beta.3
bn.js: ^5.1.2
checksum: 3/cbb23e1f6f64d528d368b73df5b084da96d66d0678d5f256bfb63321ab8bfcb899b45e88f8dde9dc56f26dd34cbdc113ed1cbfb50cc8e6889e8c277355673a00
checksum: 3/b0b80445bf5aa06a705e859e863b0a7133f20fc2bc38d0da6bcb934cddaa336fb68ea6cd92714dfbd6a2492136266a7de73fc271b5743834d280fa8d42e232a8
languageName: node
linkType: hard
@ -3418,7 +3418,7 @@ __metadata:
resolution: "@polkadot/react-api@workspace:packages/react-api"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/api": ^1.26.0-beta.1
"@polkadot/api": ^1.26.0-beta.2
"@polkadot/extension-dapp": ^0.32.0-beta.9
rxjs-compat: ^6.6.0
languageName: unknown
@ -3541,35 +3541,35 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/rpc-core@npm:1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/rpc-core@npm:1.26.0-beta.1"
"@polkadot/rpc-core@npm:1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/rpc-core@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/metadata": 1.26.0-beta.1
"@polkadot/rpc-provider": 1.26.0-beta.1
"@polkadot/types": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/metadata": 1.26.0-beta.2
"@polkadot/rpc-provider": 1.26.0-beta.2
"@polkadot/types": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/24df7e2247081ee8fb9489a46715b74ca86e6379076df7f906cddea9536e1f94e25d5341fead2157d899475b1def0930d7d5c111c213955b8b323403da7a9065
checksum: 3/9bcf6baf4d536f96ef1faf106b19da5122e021a95177055939db1de80a5e2b638cdb5e274be7cd493b817b867a4edaa41a576b8ba4b3acac5fcc9511fcd0a097
languageName: node
linkType: hard
"@polkadot/rpc-provider@npm:1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/rpc-provider@npm:1.26.0-beta.1"
"@polkadot/rpc-provider@npm:1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/rpc-provider@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/metadata": 1.26.0-beta.1
"@polkadot/types": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/util-crypto": ^2.18.1
"@polkadot/metadata": 1.26.0-beta.2
"@polkadot/types": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
"@polkadot/util-crypto": ^3.0.0-beta.3
bn.js: ^5.1.2
eventemitter3: ^4.0.4
isomorphic-fetch: ^2.2.1
websocket: ^1.0.31
checksum: 3/62919b991e86342b50b1082de4a53cbb2fb3d0051458f08db4837b32c1ae992b2d35c46e7ecefd6ba9a23a442a772ef4b0d13dcb96dceca9af59089b7d847665
checksum: 3/d0846cb77c996810e36fe843233abbee0da2cc91702acdf7fbda4485b90ce19f484d99de95d66134cafb2a92149554a07cb837002ea4c99e7415a368f132136e
languageName: node
linkType: hard
@ -3582,31 +3582,31 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/types-known@npm:1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/types-known@npm:1.26.0-beta.1"
"@polkadot/types-known@npm:1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/types-known@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/types": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/types": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
bn.js: ^5.1.2
checksum: 3/b3552571bb0e5e77439253f8e18a3fe81fd8b84c597410bdf76eee0d2a6502fb17c79775b2f6785f9d8db6b4c511953936bf379645224c40a88d76cba7eb740b
checksum: 3/4798e6906a941cd8291d37aac432e18133b360fdcf4dbe5331b47266331fc38608279982eaff9cdf7facdf102b0be3a16df32e0920d170ee46630434aa2464ac
languageName: node
linkType: hard
"@polkadot/types@npm:^1.26.0-beta.1":
version: 1.26.0-beta.1
resolution: "@polkadot/types@npm:1.26.0-beta.1"
"@polkadot/types@npm:^1.26.0-beta.2":
version: 1.26.0-beta.2
resolution: "@polkadot/types@npm:1.26.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.5
"@polkadot/metadata": 1.26.0-beta.1
"@polkadot/util": ^2.18.1
"@polkadot/util-crypto": ^2.18.1
"@polkadot/metadata": 1.26.0-beta.2
"@polkadot/util": ^3.0.0-beta.3
"@polkadot/util-crypto": ^3.0.0-beta.3
"@types/bn.js": ^4.11.6
bn.js: ^5.1.2
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/f2013b4e79563cb7fc1e53da174d203112be7c7a4e9c4d99b5caa6db5c5d30efe6e08e55a89daa5918820c1737100c35a3b7a69d97ae829c42073fe44bcbca0c
checksum: 3/dba5078fe325c0c561a148f4b6ce256bd6c50726d8fb322d4419e595f14a2d64846a0b8d99f8d2a64fb14b8f0e48aab4554c4a63b134a2deec9288ca6ab84b84
languageName: node
linkType: hard