LinkToUser.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import user from '../materials/user.png'
  2. import { Link } from 'react-router-dom'
  3. import { Avatar, Col, Row } from 'antd'
  4. export const LinkToUser = ({
  5. _id,
  6. avatar,
  7. login,
  8. size,
  9. font = '15px',
  10. padding = '10px',
  11. onClick, key
  12. }) => {
  13. return (
  14. // <Row style={{ margin:'10px', marginBottom:'20px' }}>
  15. <Row style={{ margin:'10px', marginBottom:'20px' }}>
  16. <Link
  17. to={`/profile/${_id}`}
  18. style={{
  19. display: 'flex',
  20. padding: padding,
  21. flexDirection: 'row',
  22. fontSize: font,
  23. }}
  24. onClick={onClick}
  25. key={key}
  26. >
  27. <Col offset={1} className="gutter-row" >
  28. {avatar ? (
  29. <Avatar
  30. size={size}
  31. src={'/' + avatar?.url}
  32. style={{ marginRight: '3px' }}
  33. />
  34. ) : (
  35. <Avatar size={size} src={user} style={{ marginRight: '3px' }} />
  36. )}
  37. </Col>
  38. <Col offset={2} style={{marginTop:'5px'}}>
  39. <h3> {login || 'Anon'}</h3>
  40. </Col>
  41. </Link>
  42. </Row>
  43. )
  44. }
  45. export default LinkToUser