aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Users.js
blob: c0da3748a7ea8894f1a5648361eb09b2623c8a94 (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
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import { UserType } from './Types';

export function Friends({ visitor, ...rest }) {
    return <Users data={visitor.read || []} />;
}

export function Readers({ visitor, ...rest }) {
    return <Users data={ visitor.readers || [] } />;
}

function Users({data, ...rest}) {
    return (
        <div className="users">
            {
                data.map(user => <span key={user.uid}>
                        <Link to={`/${user.uname}/`}>
                        <img src={`//i.juick.com/as/${user.uid}.png`} />
                        <span>{user.uname}</span>
                        </Link>
                    </span>)
            }
        </div>
    );
}


Friends.propTypes = {
    visitor: UserType
};

Readers.propTypes = {
    visitor: UserType
};

Users.propTypes = {
    data: PropTypes.arrayOf(UserType).isRequired
};