Small modal columns adjustment (#2659)

* Small modal columns adjustment

* Remove Button.Or

* Modal shadow
This commit is contained in:
Jaco Greeff 2020-04-29 23:32:39 +02:00 committed by GitHub
parent b6f7ed8cbd
commit fdd8374646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 30 additions and 104 deletions

View File

@ -186,13 +186,11 @@ function Overview ({ className, onStatusChange }: Props): React.ReactElement<Pro
label={t('Add account')}
onClick={toggleCreate}
/>
<Button.Or />
<Button
icon='sync'
label={t('Restore JSON')}
onClick={toggleImport}
/>
<Button.Or />
<Button
icon='qrcode'
label={t('Add via Qr')}
@ -200,7 +198,6 @@ function Overview ({ className, onStatusChange }: Props): React.ReactElement<Pro
/>
{isLedger() && (
<>
<Button.Or />
<Button
icon='question'
label={t('Query Ledger')}
@ -208,7 +205,6 @@ function Overview ({ className, onStatusChange }: Props): React.ReactElement<Pro
/>
</>
)}
<Button.Or />
<Button
icon='add'
label={t('Multisig')}

View File

@ -136,7 +136,6 @@ function Multisig ({ className, onClose, onStatusChange }: Props): React.ReactEl
label={t('Less')}
onClick={_onLess}
/>
<Button.Or />
<Button
icon='plus'
isDisabled={signatories.length === MAX_SIGNATORIES}

View File

@ -42,7 +42,6 @@ class Codes extends React.PureComponent<Props, State> {
label={t('Upload WASM')}
onClick={this.showUpload}
/>
<Button.Or />
<Button
icon='add'
label={t('Add an existing code hash')}

View File

@ -199,7 +199,6 @@ function Call (props: Props): React.ReactElement<Props> | null {
)}
<Button.Group>
<ButtonCancel onClick={onClose} />
<Button.Or />
{useRpc
? (
<Button

View File

@ -71,14 +71,11 @@ function Contracts (props: Props): React.ReactElement<Props> {
buttons={
<Button.Group>
{hasCode && (
<>
<Button
icon='cloud upload'
label={t('Deploy a code hash')}
onClick={showDeploy()}
/>
<Button.Or />
</>
<Button
icon='cloud upload'
label={t('Deploy a code hash')}
onClick={showDeploy()}
/>
)}
<Button
icon='add'

View File

@ -41,12 +41,10 @@ function Proposals ({ className, motions, prime }: Props): React.ReactElement<Pr
isMember={isMember}
members={members}
/>
<Button.Or />
<ProposeExternal
isMember={isMember}
members={members}
/>
<Button.Or />
<Slashing
isMember={isMember}
members={members}

View File

@ -52,7 +52,6 @@ function Overview ({ className, prime }: Props): React.ReactElement<Props> {
/>
<Button.Group>
<SubmitCandidacy />
<Button.Or />
<Vote electionsInfo={electionsInfo} />
</Button.Group>
<Members

View File

@ -35,21 +35,13 @@ function External ({ className, value: { image, imageHash, threshold } }: Props)
<td className='button'>
<Button.Group>
{!image?.proposal && (
<PreImageButton
imageHash={imageHash}
withoutOr
/>
<PreImageButton imageHash={imageHash} />
)}
{threshold && (
<>
{!image?.proposal && (
<Button.Or />
)}
<Fasttrack
imageHash={imageHash}
threshold={threshold}
/>
</>
<Fasttrack
imageHash={imageHash}
threshold={threshold}
/>
)}
</Button.Group>
</td>

View File

@ -14,16 +14,14 @@ import PreImage from './PreImage';
interface Props {
imageHash: Hash;
isImminent?: boolean;
withoutOr?: boolean;
}
function PreImageButton ({ imageHash, isImminent, withoutOr }: Props): React.ReactElement<Props> | null {
function PreImageButton ({ imageHash, isImminent }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const [isPreimageOpen, togglePreimage] = useToggle();
return (
<>
{!withoutOr && <Button.Or />}
<Button
icon='plus'
label={t('Preimage')}

View File

@ -34,7 +34,6 @@ function Overview ({ className }: Props): React.ReactElement {
label={t('Submit preimage')}
onClick={togglePreimage}
/>
<Button.Or />
<Button
icon='add'
label={t('Submit proposal')}

View File

@ -51,7 +51,6 @@ function Selection (): React.ReactElement {
label={t('Submit Unsigned')}
withSpinner
/>
<Button.Or />
<TxButton
accountId={accountId}
extrinsic={extrinsic}

View File

@ -180,7 +180,6 @@ function Developer ({ className, onStatusChange }: Props): React.ReactElement<Pr
label={t('Reset')}
onClick={_clearTypes}
/>
<Button.Or />
<Button
icon='save'
isDisabled={!isTypesValid || !isJsonValid}

View File

@ -126,10 +126,7 @@ function General ({ className, isModalContent, onClose }: Props): React.ReactEle
)}
<Button.Group>
{isModalContent && (
<>
<ButtonCancel onClick={onClose} />
<Button.Or />
</>
<ButtonCancel onClick={onClose} />
)}
<Button
icon='save'

View File

@ -180,7 +180,6 @@ function Account ({ className, info: { controllerId, destination, destinationId,
/>
)
}
<Button.Or key='nominate.or' />
<Button
icon='hand paper outline'
isDisabled={!isOwnController || isDisabled}

View File

@ -9,7 +9,7 @@ import { PayoutStash } from './types';
import BN from 'bn.js';
import React, { useEffect, useState } from 'react';
import ApiPromise from '@polkadot/api/promise';
import { AddressMini, Badge, TxButton } from '@polkadot/react-components';
import { AddressMini, TxButton } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks';
import { BlockToTime, FormatBalance } from '@polkadot/react-query';
@ -78,11 +78,6 @@ function Stash ({ className, isDisabled, payout: { available, rewards, stashId }
<tr className={className}>
<td className='address'><AddressMini value={stashId} /></td>
<td className='start'>
<Badge
info={rewards.length}
isInline
type='counter'
/>
<span className='payout-eras'>{eraStr}</span>
</td>
<td className='number'><FormatBalance value={available} /></td>

View File

@ -6,7 +6,7 @@ import { PayoutValidator } from './types';
import BN from 'bn.js';
import React, { useEffect, useState } from 'react';
import { AddressMini, Badge, Expander } from '@polkadot/react-components';
import { AddressMini, Expander } from '@polkadot/react-components';
import { BlockToTime, FormatBalance } from '@polkadot/react-query';
import { useTranslation } from '../translate';
@ -57,11 +57,6 @@ function Validator ({ className, isDisabled, payout }: Props): React.ReactElemen
<tr className={className}>
<td className='address'><AddressMini value={payout.validatorId} /></td>
<td className='start'>
<Badge
info={payout.eras.length}
isInline
type='counter'
/>
<span className='payout-eras'>{eraStr}</span>
</td>
<td className='number'><FormatBalance value={payout.available} /></td>

View File

@ -127,7 +127,6 @@ function Targets ({ className, ownStashes, targets: { calcWith, lastReward, nomi
label={t('Select best')}
onClick={_selectProfitable}
/>
<Button.Or />
<Nominate
ownNominators={ownNominators}
targets={selected}

View File

@ -42,7 +42,6 @@ function Overview ({ className }: Props): React.ReactElement<Props> {
/>
<Button.Group>
<ProposalCreate />
<Button.Or />
<TipCreate
members={members}
refresh={triggerHashes}

View File

@ -1,33 +0,0 @@
// Copyright 2017-2020 @polkadot/react-components 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 React from 'react';
import SUIButton from 'semantic-ui-react/dist/commonjs/elements/Button/Button';
import { isUndefined } from '@polkadot/util';
import { useTranslation } from '../translate';
interface Props {
className?: string;
style?: any;
text?: string;
}
function ButtonOr ({ className, style, text }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
return (
<SUIButton.Or
className={className}
label={
isUndefined(text)
? t('or')
: text
}
style={style}
/>
);
}
export default React.memo(ButtonOr);

View File

@ -8,13 +8,11 @@ import IButton from './Button';
import Content from './Content';
import Divider from './Divider';
import Group from './Group';
import Or from './Or';
const Button = IButton as unknown as ButtonType;
Button.Content = Content;
Button.Divider = Divider;
Button.Group = Group;
Button.Or = Or;
export default Button;

View File

@ -10,7 +10,7 @@ import SUIModal from 'semantic-ui-react/dist/commonjs/modules/Modal/Modal';
import Button from '../Button';
import ButtonCancel from '../ButtonCancel';
function Actions ({ cancelLabel, children, className, onCancel, withOr = true }: ActionsProps): React.ReactElement<ActionsProps> {
function Actions ({ cancelLabel, children, className, onCancel }: ActionsProps): React.ReactElement<ActionsProps> {
return (
<SUIModal.Actions>
<Button.Group className={className}>
@ -18,7 +18,6 @@ function Actions ({ cancelLabel, children, className, onCancel, withOr = true }:
label={cancelLabel}
onClick={onCancel}
/>
{withOr && <Button.Or />}
{children}
</Button.Group>
</SUIModal.Actions>

View File

@ -14,18 +14,15 @@ function Column ({ children, className }: ColumnProps): React.ReactElement<Colum
}
export default React.memo(styled(Column)`
padding: 0.25em 0;
&:nth-child(1) {
flex: 100%;
}
&:nth-child(2) {
background: #eee;
border-radius: 0.5rem;
display: none;
flex: 0%;
font-size: 0.95rem;
opacity: 0.75;
padding: 0.75em 1rem;
}
@media only screen and (min-width: 1024px) {
@ -38,7 +35,9 @@ export default React.memo(styled(Column)`
box-sizing: border-box;
display: block;
flex: 0 34%;
padding-left: 1rem;
font-size: 0.95rem;
opacity: 0.75;
padding: 0.25em 0.5rem;
}
}
`);

View File

@ -20,6 +20,6 @@ export default React.memo(styled(Columns)`
justify-content: space-between;
&+& {
margin-top: 0.5rem;
margin-top: 0.25rem;
}
`);

View File

@ -27,7 +27,6 @@ function ModalBase (props: ModalProps): React.ReactElement<ModalProps> {
<SUIModal
{...props}
className={`theme--default ui--Modal ${className}`}
dimmer='inverted'
header={undefined}
open={open}
>

View File

@ -94,6 +94,7 @@ export default css`
.ui.modal {
background: #f9f9f9;
box-shadow: none;
color: #4e4e4e;
font-family: sans-serif;
@ -109,11 +110,12 @@ export default css`
}
> .header:not(.ui) {
background: #f5f5f5;
background: #f9f9f9;
border-bottom: none;
font-size: 1.25rem !important;
font-weight: normal;
line-height: 1.25rem;
padding: 1rem 1.5rem;
padding: 1.5rem 1.75rem 0;
> label {
margin-top: 0.5rem;
@ -161,8 +163,13 @@ export default css`
opacity: 0.2 !important;
}
.ui.button+.ui.button {
margin-left: 0.25rem;
}
/* modals aligned to top, not center */
.ui.dimmer {
background-color: rgba(0,0,0,0.5);
justify-content: flex-start;
}

View File

@ -220,7 +220,6 @@ class Signer extends React.PureComponent<Props, State> {
{!isRenderError && (!isQrVisible || !isQrScanning) && !signedTx && (
<>
{!currentItem.isUnsigned && this.renderSignToggle()}
<Button.Or />
<Button
className='ui--signer-Signer-Submit'
icon={isQrVisible ? 'qrcode' : currentItem.isUnsigned ? 'sign-in' : (isExternal && !isMultisig) ? 'qrcode' : 'sign-in'}