Adrien Béraud | e74741b | 2021-04-19 13:22:54 -0400 | [diff] [blame^] | 1 | import React from 'react' |
| 2 | import { Avatar, List, ListItem, ListItemAvatar, ListItemText } from '@material-ui/core' |
| 3 | import { PersonRounded } from '@material-ui/icons'; |
Adrien Béraud | 6ecaa40 | 2021-04-06 17:37:25 -0400 | [diff] [blame] | 4 | |
Adrien Béraud | e74741b | 2021-04-19 13:22:54 -0400 | [diff] [blame^] | 5 | export default function AccountList(props) { |
| 6 | return <List> |
| 7 | { |
| 8 | props.accounts.map(account => { |
| 9 | const displayName = account.getDisplayNameNoFallback() |
| 10 | return <ListItem button key={account.getId()} onClick={() => props.onClick(account)}> |
| 11 | <ListItemAvatar> |
| 12 | <Avatar>{displayName ? displayName[0].toUpperCase() : <PersonRounded />}</Avatar> |
| 13 | </ListItemAvatar> |
| 14 | <ListItemText primary={account.getDisplayName()} secondary={account.getDisplayUri()} /> |
| 15 | </ListItem> |
| 16 | }) |
| 17 | } |
| 18 | </List> |
Adrien Béraud | 6ecaa40 | 2021-04-06 17:37:25 -0400 | [diff] [blame] | 19 | } |