[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
1.5 KiB

import React, { FC } from 'react'
import { Link } from 'react-router-dom'
import { useTheme, useConfig } from 'src/hooks'
import { urlForBlob } from 'src/utils'
import { User } from 'src/types'
interface Props {
user: User
}
const UserComponent: FC<Props> = ({ user }) => {
const theme = useTheme()
const config = useConfig()
const imageUrl = user && user.imageUrl ? urlForBlob(config, user.imageUrl) : undefined
const groupImageUrl = user.group && user.group.iconImageUrl ? urlForBlob(config, user.group.iconImageUrl) : undefined
return (
<div className="user">
{imageUrl &&
<div className="image">
<img src={imageUrl} style={{ width: 32 }} />
</div>
}
<div>
<Link style={{ color: theme.primary }} to={`/u/${user.id}`}>
<span style={{ fontSize: '0.9rem' }}>{user.name}</span> <span style={{ fontSize: '0.8rem', fontWeight: 'bold' }}>@{user.id}</span>
</Link>
<div className="group">
{groupImageUrl &&
<div className="image">
<img src={groupImageUrl} style={{ width: 16 }} />
</div>
}
{user.group && <Link style={{ color: theme.secondary }} to={`/c/${user.group.id}`}>{user.group.name}</Link>}
</div>
</div>
</div>
)
}
export default UserComponent