From be72ff043fc10d0f587784b8e608396c7558985b Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Tue, 29 Aug 2017 20:18:42 -0500 Subject: [PATCH 1/3] feature(currency-icon): create currency icon that factors out USD conditional --- app/components/CurrencyIcon/CurrencyIcon.js | 18 ++++++++++++++++++ .../CurrencyIcon.scss} | 0 app/components/CurrencyIcon/index.js | 3 +++ .../app/components/components/Form/Form.js | 10 +++------- app/routes/app/components/components/Nav.js | 5 +++-- 5 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 app/components/CurrencyIcon/CurrencyIcon.js rename app/components/{CryptoIcon/CryptoIcon.scss => CurrencyIcon/CurrencyIcon.scss} (100%) create mode 100644 app/components/CurrencyIcon/index.js diff --git a/app/components/CurrencyIcon/CurrencyIcon.js b/app/components/CurrencyIcon/CurrencyIcon.js new file mode 100644 index 00000000..f8019579 --- /dev/null +++ b/app/components/CurrencyIcon/CurrencyIcon.js @@ -0,0 +1,18 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { FaDollar } from 'react-icons/lib/fa' +import CryptoIcon from '../CryptoIcon' + +const CurrencyIcon = ({ currency, crypto }) => { + return currency === 'usd' ? + + : + +} + +CurrencyIcon.propTypes = { + currency: PropTypes.string.isRequired, + crypto: PropTypes.string.isRequired +} + +export default CurrencyIcon diff --git a/app/components/CryptoIcon/CryptoIcon.scss b/app/components/CurrencyIcon/CurrencyIcon.scss similarity index 100% rename from app/components/CryptoIcon/CryptoIcon.scss rename to app/components/CurrencyIcon/CurrencyIcon.scss diff --git a/app/components/CurrencyIcon/index.js b/app/components/CurrencyIcon/index.js new file mode 100644 index 00000000..b0722c92 --- /dev/null +++ b/app/components/CurrencyIcon/index.js @@ -0,0 +1,3 @@ +import CurrencyIcon from './CurrencyIcon' + +export default CurrencyIcon \ No newline at end of file diff --git a/app/routes/app/components/components/Form/Form.js b/app/routes/app/components/components/Form/Form.js index 52396a2d..7f1919a7 100644 --- a/app/routes/app/components/components/Form/Form.js +++ b/app/routes/app/components/components/Form/Form.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types' import { FaDollar } from 'react-icons/lib/fa' import { MdClose } from 'react-icons/lib/md' import CryptoIcon from '../../../../../components/CryptoIcon' +import CurrencyIcon from '../../../../../components/CurrencyIcon' import { btc } from '../../../../../utils' import styles from './Form.scss' @@ -36,7 +37,7 @@ const Form = ({ } const calculateAmount = value => (currency === 'btc' ? btc.satoshisToBtc(value) : btc.satoshisToUsd(value, currentTicker.price_usd)) - + return (
@@ -46,12 +47,7 @@ const Form = ({
(
  • - {ticker.currency === 'usd' ? : } + { ticker.currency === 'usd' ? @@ -39,7 +40,7 @@ const Nav = ({ ticker, balance, setCurrency, formClicked, currentTicker }) => (

    - {ticker.currency === 'usd' ? : } + { ticker.currency === 'usd' ? From e6c129982a5dc91e2e0734eb3d3c7b5d85d97f8f Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Tue, 29 Aug 2017 20:19:19 -0500 Subject: [PATCH 2/3] fix(remove): remove un-needed files --- app/components/CurrencyIcon/CurrencyIcon.scss | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/components/CurrencyIcon/CurrencyIcon.scss diff --git a/app/components/CurrencyIcon/CurrencyIcon.scss b/app/components/CurrencyIcon/CurrencyIcon.scss deleted file mode 100644 index e69de29b..00000000 From e16d0cd9060f8d5dfca01c0c94aab4ceffcb5b1f Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Tue, 29 Aug 2017 20:23:47 -0500 Subject: [PATCH 3/3] fix(lint): fix linting errors --- app/components/CurrencyIcon/CurrencyIcon.js | 10 ++++------ app/components/CurrencyIcon/index.js | 2 +- app/routes/app/components/components/Form/Form.js | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/components/CurrencyIcon/CurrencyIcon.js b/app/components/CurrencyIcon/CurrencyIcon.js index f8019579..19840e18 100644 --- a/app/components/CurrencyIcon/CurrencyIcon.js +++ b/app/components/CurrencyIcon/CurrencyIcon.js @@ -3,12 +3,10 @@ import PropTypes from 'prop-types' import { FaDollar } from 'react-icons/lib/fa' import CryptoIcon from '../CryptoIcon' -const CurrencyIcon = ({ currency, crypto }) => { - return currency === 'usd' ? - - : - -} +const CurrencyIcon = ({ currency, crypto }) => (currency === 'usd' ? + + : + ) CurrencyIcon.propTypes = { currency: PropTypes.string.isRequired, diff --git a/app/components/CurrencyIcon/index.js b/app/components/CurrencyIcon/index.js index b0722c92..da33382d 100644 --- a/app/components/CurrencyIcon/index.js +++ b/app/components/CurrencyIcon/index.js @@ -1,3 +1,3 @@ import CurrencyIcon from './CurrencyIcon' -export default CurrencyIcon \ No newline at end of file +export default CurrencyIcon diff --git a/app/routes/app/components/components/Form/Form.js b/app/routes/app/components/components/Form/Form.js index 7f1919a7..a286f67d 100644 --- a/app/routes/app/components/components/Form/Form.js +++ b/app/routes/app/components/components/Form/Form.js @@ -1,8 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' -import { FaDollar } from 'react-icons/lib/fa' import { MdClose } from 'react-icons/lib/md' -import CryptoIcon from '../../../../../components/CryptoIcon' import CurrencyIcon from '../../../../../components/CurrencyIcon' import { btc } from '../../../../../utils' import styles from './Form.scss' @@ -37,7 +35,7 @@ const Form = ({ } const calculateAmount = value => (currency === 'btc' ? btc.satoshisToBtc(value) : btc.satoshisToUsd(value, currentTicker.price_usd)) - + return (