1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

move footer buttons to scrollable area (#9228)

Co-authored-by: Patryk Łucka <patryk.lucka@consensys.net>
This commit is contained in:
Patryk Łucka 2020-08-18 16:10:56 +02:00 committed by GitHub
parent d5948f1cbe
commit f7e4e209ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 14 deletions

View File

@ -4,6 +4,8 @@ import classnames from 'classnames'
import { Tabs, Tab } from '../../../ui/tabs' import { Tabs, Tab } from '../../../ui/tabs'
import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from '.' import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from '.'
import ErrorMessage from '../../../ui/error-message' import ErrorMessage from '../../../ui/error-message'
import { PageContainerFooter } from '../../../ui/page-container'
export default class ConfirmPageContainerContent extends Component { export default class ConfirmPageContainerContent extends Component {
static propTypes = { static propTypes = {
@ -22,6 +24,15 @@ export default class ConfirmPageContainerContent extends Component {
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
titleComponent: PropTypes.node, titleComponent: PropTypes.node,
warning: PropTypes.string, warning: PropTypes.string,
// Footer
onCancelAll: PropTypes.func,
onCancel: PropTypes.func,
cancelText: PropTypes.string,
onSubmit: PropTypes.func,
submitText: PropTypes.string,
disabled: PropTypes.bool,
unapprovedTxCount: PropTypes.number,
rejectNText: PropTypes.string,
} }
renderContent () { renderContent () {
@ -66,6 +77,14 @@ export default class ConfirmPageContainerContent extends Component {
detailsComponent, detailsComponent,
dataComponent, dataComponent,
warning, warning,
onCancelAll,
onCancel,
cancelText,
onSubmit,
submitText,
disabled,
unapprovedTxCount,
rejectNText,
} = this.props } = this.props
return ( return (
@ -104,6 +123,21 @@ export default class ConfirmPageContainerContent extends Component {
</div> </div>
) )
} }
<PageContainerFooter
onCancel={onCancel}
cancelText={cancelText}
onSubmit={onSubmit}
submitText={submitText}
submitButtonType="confirm"
disabled={disabled}
>
{unapprovedTxCount > 1 && (
<a onClick={onCancelAll}>
{rejectNText}
</a>
)}
</PageContainerFooter>
</div> </div>
) )
} }

View File

@ -5,6 +5,8 @@
overflow-y: auto; overflow-y: auto;
height: 100%; height: 100%;
flex: 1; flex: 1;
display: flex;
flex-direction: column;
&__error-container { &__error-container {
padding: 0 16px 16px 16px; padding: 0 16px 16px 16px;
@ -72,4 +74,8 @@
text-transform: uppercase; text-transform: uppercase;
margin: 0 8px; margin: 0 8px;
} }
.page-container__footer {
margin-top: auto;
}
} }

View File

@ -157,23 +157,35 @@ export default class ConfirmPageContainer extends Component {
nonce={nonce} nonce={nonce}
assetImage={assetImage} assetImage={assetImage}
warning={warning} warning={warning}
onCancelAll={onCancelAll}
onCancel={onCancel}
cancelText={this.context.t('reject')}
onSubmit={onSubmit}
submitText={this.context.t('confirm')}
disabled={disabled}
unapprovedTxCount={unapprovedTxCount}
rejectNText={this.context.t('rejectTxsN', [unapprovedTxCount])}
/> />
) )
} }
<PageContainerFooter {
onCancel={() => onCancel()} contentComponent && (
cancelText={this.context.t('reject')} <PageContainerFooter
onSubmit={() => onSubmit()} onCancel={onCancel}
submitText={this.context.t('confirm')} cancelText={this.context.t('reject')}
submitButtonType="confirm" onSubmit={onSubmit}
disabled={disabled} submitText={this.context.t('confirm')}
> submitButtonType="confirm"
{unapprovedTxCount > 1 && ( disabled={disabled}
<a onClick={() => onCancelAll()}> >
{this.context.t('rejectTxsN', [unapprovedTxCount])} {unapprovedTxCount > 1 && (
</a> <a onClick={onCancelAll}>
)} {this.context.t('rejectTxsN', [unapprovedTxCount])}
</PageContainerFooter> </a>
)}
</PageContainerFooter>
)
}
</div> </div>
) )
} }