@material-ui/lab#AvatarGroup JavaScript Examples
The following examples show how to use
@material-ui/lab#AvatarGroup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Notification.jsx From zubhub with GNU Affero General Public License v3.0 | 5 votes |
Notification = ({ notification, onNotificationClick }) => {
const classes = useStyles();
const token = useSelector(store => store.auth.token);
const { t } = useTranslation();
const st = dFormatter(JSON.parse('"' + notification.date + '"'));
return (
<Link to={notification.link} className={classes.notificationLink}>
<ListItem
alignItems="center"
disableGutters
button
className={classes.notificationStyle}
onClick={() => {
if (!notification.viewed) {
let obj = new API();
obj.viewNotification({
id: notification.id,
token: token,
body: notification,
});
}
onNotificationClick();
}}
>
<ListItemAvatar>
{notification.sources.length === 1 && (
<AvatarGroup className={classes.group}>
<Avatar
className={classes.image}
src={notification.sources[0].avatar}
/>
</AvatarGroup>
)}
{notification.sources.length > 1 && (
<AvatarGroup className={classes.group}>
<Avatar
className={classes.firstImage}
src={notification.sources[0].avatar}
/>
<Avatar
className={classes.secondImage}
src={notification.sources[1].avatar}
/>
</AvatarGroup>
)}
</ListItemAvatar>
<ListItemText
className={classes.text}
classes={{ primary: classes.message, secondary: classes.time }}
primary={
<span
dangerouslySetInnerHTML={{
__html: notification.message,
}}
></span>
}
secondary={st.value + ' ' + st.key + ' ' + 'ago'}
/>
{!notification.viewed && <div className={classes.viewDot}></div>}
{notification.viewed && <div className={classes.unviewed}></div>}
</ListItem>
</Link>
);
}