import React from 'react' import PropTypes from 'prop-types' import { TiPlus } from 'react-icons/lib/ti' import { FaRepeat } from 'react-icons/lib/fa' import PeerModal from './PeerModal' import PeerForm from './PeerForm' import Peer from './Peer' import styles from './Peers.scss' const Peers = ({ fetchPeers, peersLoading, peers, setPeer, modalPeer, peerModalOpen, peerForm, setPeerForm, connect, disconnect }) => { const refreshClicked = (event) => { // store event in icon so we dont get an error when react clears it const icon = event.currentTarget // fetch peers fetchPeers() // clear animation after the second so we can reuse it setTimeout(() => { icon.style.animation = '' }, 1000) // spin icon for 1 sec icon.style.animation = 'spin 1000ms linear 1' } return (