Refactor ConfirmPageContainerError to ErrorMessage

feature/default_network_editable
Alexander Tseung 6 years ago
parent 3c3fed46cb
commit 44d4b5b5db
  1. 9
      ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js
  2. 1
      ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-error/index.js
  3. 1
      ui/app/components/confirm-page-container/confirm-page-container-content/index.js
  4. 2
      ui/app/components/confirm-page-container/confirm-page-container-content/index.scss
  5. 14
      ui/app/components/error-message/error-message.component.js
  6. 1
      ui/app/components/error-message/index.js
  7. 2
      ui/app/components/error-message/index.scss
  8. 2
      ui/app/components/index.scss

@ -2,11 +2,8 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { Tabs, Tab } from '../../tabs'
import {
ConfirmPageContainerSummary,
ConfirmPageContainerError,
ConfirmPageContainerWarning,
} from './'
import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from './'
import ErrorMessage from '../../error-message'
export default class ConfirmPageContainerContent extends Component {
static propTypes = {
@ -95,7 +92,7 @@ export default class ConfirmPageContainerContent extends Component {
{
(errorKey || errorMessage) && (
<div className="confirm-page-container-content__error-container">
<ConfirmPageContainerError
<ErrorMessage
errorMessage={errorMessage}
errorKey={errorKey}
/>

@ -1,4 +1,3 @@
export { default } from './confirm-page-container-content.component'
export { default as ConfirmPageContainerSummary } from './confirm-page-container-summary'
export { default as ConfirmPageContainerError } from './confirm-page-container-error'
export { default as ConfirmPageContainerWarning } from './confirm-page-container-warning'

@ -1,5 +1,3 @@
@import './confirm-page-container-error/index';
@import './confirm-page-container-warning/index';
@import './confirm-page-container-summary/index';

@ -1,30 +1,30 @@
import React from 'react'
import PropTypes from 'prop-types'
const ConfirmPageContainerError = (props, context) => {
const ErrorMessage = (props, context) => {
const { errorMessage, errorKey } = props
const error = errorKey ? context.t(errorKey) : errorMessage
return (
<div className="confirm-page-container-error">
<div className="error-message">
<img
src="/images/alert-red.svg"
className="confirm-page-container-error__icon"
className="error-message__icon"
/>
<div className="confirm-page-container-error__text">
<div className="error-message__text">
{ `ALERT: ${error}` }
</div>
</div>
)
}
ConfirmPageContainerError.propTypes = {
ErrorMessage.propTypes = {
errorMessage: PropTypes.string,
errorKey: PropTypes.string,
}
ConfirmPageContainerError.contextTypes = {
ErrorMessage.contextTypes = {
t: PropTypes.func,
}
export default ConfirmPageContainerError
export default ErrorMessage

@ -0,0 +1 @@
export { default } from './error-message.component'

@ -1,4 +1,4 @@
.confirm-page-container-error {
.error-message {
min-height: 32px;
border: 1px solid $monzo;
color: $monzo;

@ -6,6 +6,8 @@
@import './confirm-page-container/index';
@import './error-message/index';
@import './export-text-container/index';
@import './info-box/index';

Loading…
Cancel
Save