Signer layouts to flexbox (#3600)

* Use variables for signer form widths

* Simplify signer layouts with flex

* Fix styling issues with Signer
This commit is contained in:
Jaco Greeff 2016-11-25 17:20:16 +01:00 committed by GitHub
parent 7610336596
commit e95ef0160f
16 changed files with 145 additions and 127 deletions

View File

@ -14,6 +14,7 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
.bar, .expanded { .bar, .expanded {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@ -42,8 +43,7 @@
.expanded { .expanded {
right: 16px; right: 16px;
width: 964px; max-height: 300px;
height: 300px;
border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;

View File

@ -0,0 +1,24 @@
/* Copyright 2015, 2016 Ethcore (UK) Ltd.
/* This file is part of Parity.
/*
/* Parity is free software: you can redistribute it and/or modify
/* it under the terms of the GNU General Public License as published by
/* the Free Software Foundation, either version 3 of the License, or
/* (at your option) any later version.
/*
/* Parity is distributed in the hope that it will be useful,
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/* GNU General Public License for more details.
/*
/* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/
$pendingHeight: 190px;
$finishedHeight: 120px;
$embedWidth: 920px;
$statusWidth: 260px;
$accountPadding: 75px;

View File

@ -14,31 +14,35 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.container { .container {
position: relative; display: flex;
padding: 25px 0 15px; padding: 1.5em 0 1em;
} }
.actions, .signDetails { .actions, .signDetails {
display: inline-block;
vertical-align: middle; vertical-align: middle;
min-height: 120px; min-height: $pendingHeight;
} }
.signDetails { .signDetails {
border-right: 1px solid #eee; flex: 1;
margin-right: 2rem;
/* TODO [todr] mess - just to align with transaction */
width: 430px;
} }
.address, .info { .address, .info {
box-sizing: border-box;
display: inline-block; display: inline-block;
width: 50%;
}
.address {
padding-right: $accountPadding;
} }
.info { .info {
padding: 0 30px; padding: 0 30px;
width: 250px;
color: #E53935; color: #E53935;
vertical-align: top; vertical-align: top;
} }
@ -63,7 +67,7 @@
.actions { .actions {
display: inline-block; display: inline-block;
min-height: 120px; min-height: $finishedHeight;
} }
.signDetails img { .signDetails img {

View File

@ -15,31 +15,26 @@
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.container { .container {
padding: 25px 0 15px; display: flex;
} padding: 1.5em 0 1em;
.mainContainer { & > * {
position: relative; vertical-align: middle;
} min-height: $finishedHeight;
}
.mainContainer > * {
vertical-align: middle;
min-height: 120px;
} }
.statusContainer { .statusContainer {
width: 220px; box-sizing: border-box;
padding: 0 40px 0 40px; float: right;
/*border-left: 1px solid #aaa;*/ padding: 0 1em;
position: absolute; flex: 0 0 $statusWidth;
top: 0;
right: 0;
box-sizing: content-box;
} }
.transactionDetails { .transactionDetails {
padding-right: 321px;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }

View File

@ -63,22 +63,20 @@ export default class TransactionFinished extends Component {
return ( return (
<div className={ `${styles.container} ${className || ''}` }> <div className={ `${styles.container} ${className || ''}` }>
<div className={ styles.mainContainer }> <TransactionMainDetails
<TransactionMainDetails { ...this.props }
{ ...this.props } { ...this.state }
{ ...this.state } fromBalance={ fromBalance }
fromBalance={ fromBalance } toBalance={ toBalance }
toBalance={ toBalance } className={ styles.transactionDetails }
className={ styles.transactionDetails } >
> <TransactionSecondaryDetails
<TransactionSecondaryDetails id={ id }
id={ id } date={ date }
date={ date } />
/> </TransactionMainDetails>
</TransactionMainDetails> <div className={ styles.statusContainer }>
<div className={ styles.statusContainer }> { this.renderStatus() }
{ this.renderStatus() }
</div>
</div> </div>
</div> </div>
); );

View File

@ -14,7 +14,11 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.transaction { .transaction {
flex: 1;
} }
.transaction > * { .transaction > * {
@ -30,11 +34,11 @@
} }
.from .account { .from .account {
padding-right: 75px; padding-right: $accountPadding;
} }
.to .account { .to .account {
padding-left: 75px; padding-left: $accountPadding;
} }
.from img, .to img { .from img, .to img {

View File

@ -33,7 +33,6 @@ export default class TransactionMainDetails extends Component {
isTest: PropTypes.bool.isRequired, isTest: PropTypes.bool.isRequired,
to: PropTypes.string, // undefined if it's a contract to: PropTypes.string, // undefined if it's a contract
toBalance: PropTypes.object, // eth BigNumber - undefined if it's a contract or until it's fetched toBalance: PropTypes.object, // eth BigNumber - undefined if it's a contract or until it's fetched
className: PropTypes.string,
children: PropTypes.node children: PropTypes.node
}; };
@ -60,23 +59,15 @@ export default class TransactionMainDetails extends Component {
} }
render () { render () {
const { className, children } = this.props; const { to } = this.props;
return ( return to
<div className={ className }> ? this.renderTransfer()
{ this.renderTransfer() } : this.renderContract();
{ this.renderContract() }
{ children }
</div>
);
} }
renderTransfer () { renderTransfer () {
const { from, fromBalance, to, toBalance, isTest } = this.props; const { children, from, fromBalance, to, toBalance, isTest } = this.props;
if (!to) {
return;
}
return ( return (
<div className={ styles.transaction }> <div className={ styles.transaction }>
@ -101,16 +92,13 @@ export default class TransactionMainDetails extends Component {
isTest={ isTest } /> isTest={ isTest } />
</div> </div>
</div> </div>
{ children }
</div> </div>
); );
} }
renderContract () { renderContract () {
const { from, fromBalance, to, isTest } = this.props; const { children, from, fromBalance, isTest } = this.props;
if (to) {
return;
}
return ( return (
<div className={ styles.transaction }> <div className={ styles.transaction }>
@ -134,6 +122,7 @@ export default class TransactionMainDetails extends Component {
Contract Contract
</div> </div>
</div> </div>
{ children }
</div> </div>
); );
} }

View File

@ -14,33 +14,14 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.container { .container {
padding: 25px 0 15px; display: flex;
} padding: 1.5em 0 1em;
.transactionDetails { & > * {
padding-right: 321px; vertical-align: middle;
width: 100%; }
box-sizing: border-box;
}
.mainContainer {
position: relative;
}
.mainContainer:after {
clear: both;
}
.mainContainer > * {
vertical-align: middle;
min-height: 190px;
}
.inputs {
margin-right: 30px;
margin-left: 30px;
width: 180px;
position: relative;
top: -15px; /* due to material ui weird styling */
} }

View File

@ -70,29 +70,27 @@ export default class TransactionPending extends Component {
return ( return (
<div className={ `${styles.container} ${className || ''}` }> <div className={ `${styles.container} ${className || ''}` }>
<div className={ styles.mainContainer }> <TransactionMainDetails
<TransactionMainDetails { ...this.props }
{ ...this.props } { ...this.state }
{ ...this.state } fromBalance={ fromBalance }
fromBalance={ fromBalance } toBalance={ toBalance }
toBalance={ toBalance } className={ styles.transactionDetails }
className={ styles.transactionDetails } totalValue={ totalValue }>
totalValue={ totalValue }> <TransactionSecondaryDetails
<TransactionSecondaryDetails id={ id }
id={ id } date={ date }
date={ date } data={ data }
data={ data } gasPriceEthmDisplay={ gasPriceEthmDisplay }
gasPriceEthmDisplay={ gasPriceEthmDisplay } gasToDisplay={ gasToDisplay }
gasToDisplay={ gasToDisplay }
/>
</TransactionMainDetails>
<TransactionPendingForm
address={ from }
isSending={ this.props.isSending }
onConfirm={ this.onConfirm }
onReject={ this.onReject }
/> />
</div> </TransactionMainDetails>
<TransactionPendingForm
address={ from }
isSending={ this.props.isSending }
onConfirm={ this.onConfirm }
onReject={ this.onReject }
/>
</div> </div>
); );
} }

View File

@ -14,14 +14,13 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.container { .container {
width: 220px; box-sizing: border-box;
padding: 20px 40px 0 40px; padding: 1em 1em 0 1em;
/*border-left: 1px solid #aaa;*/ flex: 0 0 $statusWidth;
position: absolute;
top: 0;
right: 0;
box-sizing: content-box;
} }
.rejectToggle { .rejectToggle {

View File

@ -15,7 +15,7 @@
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
.confirmForm { .confirmForm {
margin-top: -45px; margin-top: -2em;
} }
.confirmButton { .confirmButton {

View File

@ -14,6 +14,7 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* the rejection button itself, once .reject has been pressed */ /* the rejection button itself, once .reject has been pressed */
.rejectButton { .rejectButton {
display: block !important; display: block !important;

View File

@ -1,3 +1,24 @@
/* Copyright 2015, 2016 Ethcore (UK) Ltd.
/* This file is part of Parity.
/*
/* Parity is free software: you can redistribute it and/or modify
/* it under the terms of the GNU General Public License as published by
/* the Free Software Foundation, either version 3 of the License, or
/* (at your option) any later version.
/*
/* Parity is distributed in the hope that it will be useful,
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/* GNU General Public License for more details.
/*
/* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/
.container {
display: block;
}
.iconsContainer { .iconsContainer {
display: block; display: block;
text-align: center; text-align: center;
@ -67,4 +88,3 @@
.expandedContainer:empty { .expandedContainer:empty {
padding: 0; padding: 0;
} }

View File

@ -27,7 +27,6 @@ import styles from './TransactionSecondaryDetails.css';
import * as tUtil from '../util/transaction'; import * as tUtil from '../util/transaction';
export default class TransactionSecondaryDetails extends Component { export default class TransactionSecondaryDetails extends Component {
static propTypes = { static propTypes = {
id: PropTypes.object.isRequired, id: PropTypes.object.isRequired,
date: PropTypes.instanceOf(Date), date: PropTypes.instanceOf(Date),
@ -45,7 +44,7 @@ export default class TransactionSecondaryDetails extends Component {
const className = this.props.className || ''; const className = this.props.className || '';
return ( return (
<div className={ className }> <div className={ `${styles.container} ${className}` }>
<div className={ styles.iconsContainer }> <div className={ styles.iconsContainer }>
{ this.renderGasPrice() } { this.renderGasPrice() }
{ this.renderData() } { this.renderData() }

View File

@ -14,8 +14,13 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
@import '../../_layout.css';
.signer { .signer {
width: 916px; box-sizing: border-box;
padding: 0;
width: $embedWidth;
} }
.pending { .pending {

View File

@ -14,6 +14,7 @@
/* You should have received a copy of the GNU General Public License /* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. /* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/ */
.request { .request {
} }