import React, { Component } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { Tabs, Tab } from '../../tabs' import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from './' import ErrorMessage from '../../error-message' export default class ConfirmPageContainerContent extends Component { static propTypes = { action: PropTypes.string, dataComponent: PropTypes.node, detailsComponent: PropTypes.node, errorKey: PropTypes.string, errorMessage: PropTypes.string, hideSubtitle: PropTypes.bool, identiconAddress: PropTypes.string, nonce: PropTypes.string, assetImage: PropTypes.string, subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), summaryComponent: PropTypes.node, title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), titleComponent: PropTypes.func, warning: PropTypes.string, } renderContent () { const { detailsComponent, dataComponent } = this.props if (detailsComponent && dataComponent) { return this.renderTabs() } else { return detailsComponent || dataComponent } } renderTabs () { const { detailsComponent, dataComponent } = this.props return ( { detailsComponent } { dataComponent } ) } render () { const { action, errorKey, errorMessage, title, subtitle, hideSubtitle, identiconAddress, nonce, assetImage, summaryComponent, detailsComponent, dataComponent, warning, } = this.props return (
{ warning && ( ) } { summaryComponent || ( ) } { this.renderContent() } { (errorKey || errorMessage) && (
) }
) } }