[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.

39 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import React, { FC } from 'react'
  2. import { Link } from 'react-router-dom'
  3. import { useTheme } from '../hooks'
  4. import { User } from '../types'
  5. interface Props {
  6. user: User
  7. }
  8. const UserComponent: FC<Props> = ({ user }) => {
  9. const theme = useTheme()
  10. const groupImageUrl = user?.group?.iconImageUrl
  11. return (
  12. <div className="user">
  13. {user.imageUrl &&
  14. <div className="image">
  15. <img src={user.imageUrl} style={{ width: 32 }} />
  16. </div>
  17. }
  18. <div>
  19. <Link style={{ color: theme.primary }} to={`/u/${user.id}`}>
  20. <span style={{ fontSize: '0.9rem' }}>{user.name}</span> <span style={{ fontSize: '0.8rem', fontWeight: 'bold' }}>@{user.id}</span>
  21. </Link>
  22. <div className="group">
  23. {groupImageUrl &&
  24. <div className="image">
  25. <img src={groupImageUrl} style={{ width: 16 }} />
  26. </div>
  27. }
  28. {user.group && <Link style={{ color: theme.secondary }} to={`/c/${user.group.id}`}>{user.group.name}</Link>}
  29. </div>
  30. </div>
  31. </div>
  32. )
  33. }
  34. export default UserComponent