2020-04-10 20:55:57 +00:00
|
|
|
import { Component } from 'inferno';
|
|
|
|
import { Link } from 'inferno-router';
|
|
|
|
import { UserView } from '../interfaces';
|
2020-06-09 21:17:24 +00:00
|
|
|
import { pictrsAvatarThumbnail, showAvatars } from '../utils';
|
2020-04-10 20:55:57 +00:00
|
|
|
|
|
|
|
interface UserOther {
|
|
|
|
name: string;
|
|
|
|
avatar?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface UserListingProps {
|
|
|
|
user: UserView | UserOther;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class UserListing extends Component<UserListingProps, any> {
|
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let user = this.props.user;
|
|
|
|
return (
|
|
|
|
<Link className="text-body font-weight-bold" to={`/u/${user.name}`}>
|
|
|
|
{user.avatar && showAvatars() && (
|
|
|
|
<img
|
|
|
|
height="32"
|
|
|
|
width="32"
|
2020-06-09 21:17:24 +00:00
|
|
|
src={pictrsAvatarThumbnail(user.avatar)}
|
2020-04-10 20:55:57 +00:00
|
|
|
class="rounded-circle mr-2"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<span>{user.name}</span>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|