Browse Source

Merge pull request #12 from LN-Zap/fix/refactor-currency-icon

Fix/refactor currency icon
renovate/lint-staged-8.x
jackmallers 7 years ago
committed by GitHub
parent
commit
6323c7a4a7
  1. 0
      app/components/CryptoIcon/CryptoIcon.scss
  2. 16
      app/components/CurrencyIcon/CurrencyIcon.js
  3. 3
      app/components/CurrencyIcon/index.js
  4. 10
      app/routes/app/components/components/Form/Form.js
  5. 5
      app/routes/app/components/components/Nav.js

0
app/components/CryptoIcon/CryptoIcon.scss

16
app/components/CurrencyIcon/CurrencyIcon.js

@ -0,0 +1,16 @@
import React from 'react'
import PropTypes from 'prop-types'
import { FaDollar } from 'react-icons/lib/fa'
import CryptoIcon from '../CryptoIcon'
const CurrencyIcon = ({ currency, crypto }) => (currency === 'usd' ?
<FaDollar />
:
<CryptoIcon currency={crypto} />)
CurrencyIcon.propTypes = {
currency: PropTypes.string.isRequired,
crypto: PropTypes.string.isRequired
}
export default CurrencyIcon

3
app/components/CurrencyIcon/index.js

@ -0,0 +1,3 @@
import CurrencyIcon from './CurrencyIcon'
export default CurrencyIcon

10
app/routes/app/components/components/Form/Form.js

@ -1,8 +1,7 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { FaDollar } from 'react-icons/lib/fa'
import { MdClose } from 'react-icons/lib/md' import { MdClose } from 'react-icons/lib/md'
import CryptoIcon from '../../../../../components/CryptoIcon' import CurrencyIcon from '../../../../../components/CurrencyIcon'
import { btc } from '../../../../../utils' import { btc } from '../../../../../utils'
import styles from './Form.scss' import styles from './Form.scss'
@ -46,12 +45,7 @@ const Form = ({
<div className={styles.content}> <div className={styles.content}>
<section className={styles.amountContainer}> <section className={styles.amountContainer}>
<label htmlFor='amount'> <label htmlFor='amount'>
{ <CurrencyIcon currency={currency} crypto={crypto} />
currency === 'usd' ?
<FaDollar />
:
<CryptoIcon currency={crypto} />
}
</label> </label>
<input <input
type='text' type='text'

5
app/routes/app/components/components/Nav.js

@ -5,6 +5,7 @@ import ReactSVG from 'react-svg'
import { MdAccountBalanceWallet } from 'react-icons/lib/md' import { MdAccountBalanceWallet } from 'react-icons/lib/md'
import { FaClockO, FaDollar } from 'react-icons/lib/fa' import { FaClockO, FaDollar } from 'react-icons/lib/fa'
import CryptoIcon from '../../../../components/CryptoIcon' import CryptoIcon from '../../../../components/CryptoIcon'
import CurrencyIcon from '../../../../components/CurrencyIcon'
import { btc } from '../../../../utils' import { btc } from '../../../../utils'
import styles from './Nav.scss' import styles from './Nav.scss'
@ -28,7 +29,7 @@ const Nav = ({ ticker, balance, setCurrency, formClicked, currentTicker }) => (
</li> </li>
<li className={`${styles.balance} ${styles.link}`}> <li className={`${styles.balance} ${styles.link}`}>
<p data-hint='Wallet balance' className='hint--bottom-left'> <p data-hint='Wallet balance' className='hint--bottom-left'>
<span>{ticker.currency === 'usd' ? <FaDollar /> : <CryptoIcon currency={ticker.crypto} />}</span> <span><CurrencyIcon currency={ticker.currency} crypto={ticker.crypto} /></span>
<span> <span>
{ {
ticker.currency === 'usd' ? ticker.currency === 'usd' ?
@ -39,7 +40,7 @@ const Nav = ({ ticker, balance, setCurrency, formClicked, currentTicker }) => (
</span> </span>
</p> </p>
<p data-hint='Channel balance' className='hint--bottom-left'> <p data-hint='Channel balance' className='hint--bottom-left'>
<span>{ticker.currency === 'usd' ? <FaDollar /> : <CryptoIcon currency={ticker.crypto} />}</span> <span><CurrencyIcon currency={ticker.currency} crypto={ticker.crypto} /></span>
<span> <span>
{ {
ticker.currency === 'usd' ? ticker.currency === 'usd' ?

Loading…
Cancel
Save