blowfish/src/renderer/components/AccountsList/Saved.jsx

45 lines
1.0 KiB
React
Raw Normal View History

2019-09-09 00:13:38 +02:00
import React from 'react'
import PropTypes from 'prop-types'
import { toDataUrl } from 'ethereum-blockies'
import posed, { PoseGroup } from 'react-pose'
import { fadeIn } from '../Animations'
2019-09-09 00:13:38 +02:00
import styles from './Saved.module.css'
2019-09-24 01:13:02 +02:00
export default function Saved({ accounts, handleDelete }) {
const Item = posed.li(fadeIn)
2019-09-09 00:13:38 +02:00
2019-09-24 01:13:02 +02:00
return (
<PoseGroup>
{accounts.map(account => {
const identicon = toDataUrl(account)
2019-09-09 00:13:38 +02:00
2019-09-24 01:13:02 +02:00
return (
<Item key={account}>
<div>
<img
className={styles.identicon}
src={identicon}
alt="Blockies"
/>
{account}
</div>
2019-09-09 00:13:38 +02:00
2019-09-24 01:13:02 +02:00
<button
className={styles.delete}
onClick={e => handleDelete(e, account)}
title="Remove account"
>
&times;
</button>
</Item>
)
})}
</PoseGroup>
)
}
2019-09-09 00:13:38 +02:00
Saved.propTypes = {
accounts: PropTypes.array.isRequired,
handleDelete: PropTypes.func.isRequired
}