blob: a837961e925f102f4c2407306c88ffab1861a575 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import VerifiedIcon from '@material-ui/icons/CheckCircleOutline';
import { CardHeader } from '@material-ui/core/';
import { User } from 'which-types';
import Avatar from '../Avatar/Avatar';
interface PropTypes {
user: User;
info?: string | JSX.Element
}
const useStyles = makeStyles(theme => ({
root: {
display: 'flex',
alignItems: 'center'
},
verified: {
marginLeft: theme.spacing(0.5),
width: theme.spacing(2),
height: theme.spacing(2)
}
}));
const UserStrip: React.FC<PropTypes> = ({ user, info }) => {
const classes = useStyles();
const { username, verified } = user;
const avatar = <Avatar user={user} />;
const title = (
<div className={classes.root}>
{username}
{verified && <VerifiedIcon color="primary" className={classes.verified} />}
</div>
);
return <CardHeader avatar={avatar} title={title} subheader={info} />;
};
export default UserStrip;
|