From 8f77aedc705d869bf548c8478a6d654abbbc5491 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Mon, 3 Jul 2017 19:09:33 -0500 Subject: [PATCH] swapProgress: create computed class for active step; cleanup --- .../Tabs/Swap/components/swapProgress.js | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/common/containers/Tabs/Swap/components/swapProgress.js b/common/containers/Tabs/Swap/components/swapProgress.js index f937ac36..dbcbed7e 100644 --- a/common/containers/Tabs/Swap/components/swapProgress.js +++ b/common/containers/Tabs/Swap/components/swapProgress.js @@ -1,6 +1,6 @@ +//flow import React, { Component } from 'react'; import PropTypes from 'prop-types'; -// import { toFixedIfLarger } from 'utils/formatters'; import translate from 'translations'; export default class SwapProgress extends Component { @@ -9,34 +9,48 @@ export default class SwapProgress extends Component { } static propTypes = { - numberOfConfirmations: PropTypes.number, - destinationKind: PropTypes.string, - originKind: PropTypes.string, - activeStep: PropTypes.number + numberOfConfirmations: PropTypes.number.isRequired, + destinationKind: PropTypes.string.isRequired, + originKind: PropTypes.string.isRequired, + activeStep: PropTypes.number.isRequired }; + computedClass(i: number) { + const { activeStep } = this.props; + let cssClass = 'progress-item'; + if (activeStep > i) { + cssClass += ' progress-true'; + } else if (i === activeStep) { + cssClass += ' progress-active'; + } else { + cssClass += ''; + } + return cssClass; + } + render() { const { numberOfConfirmations, destinationKind, originKind } = this.props; return (
-
+ +
1

{translate('SWAP_progress_1')}

-
+
2

{translate('SWAP_progress_2')}{originKind}...

-
+
3

{originKind} {translate('SWAP_progress_3')}

-
+
4

Sending your {destinationKind} @@ -46,7 +60,7 @@ export default class SwapProgress extends Component {

-
+
5

Order Complete