import React from 'react'; import { Link } from 'react-router-dom'; import './Promos.scss'; const promos = [ { isExternal: true, color: '#6e9a3e', href: 'https://myetherwallet.groovehq.com/knowledge_base/topics/protecting-yourself-and-your-funds', texts: [
Learn more about protecting your funds.
], images: [ require('assets/images/logo-ledger.svg'), require('assets/images/logo-trezor.svg') ] }, { isExternal: true, color: '#2b71b1', href: 'https://buy.coinbase.com?code=a6e1bd98-6464-5552-84dd-b27f0388ac7d&address=0xA7DeFf12461661212734dB35AdE9aE7d987D648c&crypto_currency=ETH¤cy=USD', texts: [

It’s now easier to get more ETH

,
Buy ETH with USD
], images: [require('assets/images/logo-coinbase.svg')] }, { isExternal: false, color: '#006e79', href: '/swap', texts: [

It’s now easier to get more ETH

,
Swap BTC <-> ETH
], images: [require('assets/images/logo-bity-white.svg')] } ]; interface State { activePromo: number; } export default class Promos extends React.Component<{}, State> { public state = { activePromo: parseInt(String(Math.random() * promos.length), 10) }; public render() { const { activePromo } = this.state; const promo = promos[activePromo]; const promoContent = (
{promo.texts}
{promo.images.map((img, idx) => )}
); const promoEl = promo.isExternal ? ( {promoContent} ) : (
{promoContent}
); return (
{promoEl}
{promos.map((_, index) => { return (
); } private navigateToPromo = (idx: number) => () => { this.setState({ activePromo: Math.max(0, Math.min(promos.length, idx)) }); }; }