aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Avatar.js
blob: f79d7b091428c649cef1879e5dddb42a6d2da506 (plain) (blame)
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
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import { UserType } from './Types';

export default function Avatar(props) {
    return (
        <div style={{ display: 'flex' }}>
            <div className="msg-avatar">
                <Link to={{ pathname: props.link || `/${props.user.uname}/` }}>
                    <img src={`//i.juick.com/a/${props.user.uid}.png`} alt={`${props.user.uname}`} />
                </Link>
            </div>
            <div style={{ display: 'flex', flexDirection: 'column' }}>
                <span itemProp="author" itemScope="" itemType="http://schema.org/Person">
                    <Link to={{ pathname: `/${props.user.uname}/` }} itemProp="url" rel="author">
                        <span itemProp="name">{props.user.uname}</span>
                    </Link>
                </span>
                {props.children}
            </div>
        </div>
    );
}

Avatar.propTypes = {
    user: UserType,
    link: PropTypes.string,
    children: PropTypes.node
};