import React, { Component } from 'react' import PropTypes from 'prop-types' import AccountListItem from '../../../account-list-item/account-list-item.container' export default class FromDropdown extends Component { static propTypes = { accounts: PropTypes.array, closeDropdown: PropTypes.func, dropdownOpen: PropTypes.bool, onSelect: PropTypes.func, openDropdown: PropTypes.func, selectedAccount: PropTypes.object, }; renderListItemIcon (icon, color) { return } getListItemIcon (currentAccount, selectedAccount) { return currentAccount.address === selectedAccount.address ? this.renderListItemIcon('fa-check', '#02c9b1') : null } renderDropdown () { const { accounts, closeDropdown, onSelect, selectedAccount, } = this.props return (
closeDropdown} />
{accounts.map((account, index) => { onSelect(account) closeDropdown() }} icon={this.getListItemIcon(account, selectedAccount.address)} key={`from-dropdown-account-#${index}`} />)}
) } render () { const { dropdownOpen, openDropdown, selectedAccount, } = this.props return
{dropdownOpen && this.renderDropdown()},
} } FromDropdown.contextTypes = { t: PropTypes.func, }