LinkToUser.jsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import user from '../materials/user.png'
  2. import { Link } from 'react-router-dom'
  3. import { Avatar, Col, Row } from 'antd'
  4. import { CSubscribeLinkUser } from '../components/Subscribe'
  5. import backendURL from '../helpers/backendUrl'
  6. export const LinkToUser = ({
  7. _id,
  8. avatar,
  9. login,
  10. size,
  11. // font = '15px',
  12. // padding = '10px',
  13. onClick,
  14. key,
  15. }) => {
  16. return (
  17. <Row style={{ marginBottom:'5px'}}>
  18. <Link
  19. to={`/profile/${_id}`}
  20. // style={{
  21. // display: 'flex',
  22. // padding: padding,
  23. // flexDirection: 'row',
  24. // fontSize: font,
  25. // fontWeight: 'bold',
  26. // color: 'black'
  27. // }}
  28. className="ModalLink"
  29. onClick={onClick}
  30. key={key}
  31. >
  32. <Col offset={1} className="gutter-row">
  33. {avatar ? (
  34. <Avatar
  35. className='ModalAvatar'
  36. src={backendURL+'/' + avatar?.url}
  37. />
  38. ) : (
  39. <Avatar className='ModalAvatar' src={user}
  40. // style={{ marginRight: '3px' }}
  41. />
  42. )}
  43. </Col>
  44. <Col offset={3} style={{ marginTop: '5px' }}>
  45. <h3 className="ModalLink"
  46. > {login || 'Anon'}</h3>
  47. </Col>
  48. </Link>
  49. </Row>
  50. )
  51. }
  52. export const LinkWithSubscribe = ({
  53. _id,
  54. avatar,
  55. login,
  56. size,
  57. // font = '15px',
  58. // padding = '10px',
  59. onClick,
  60. key,
  61. myId,
  62. }) => {
  63. return (
  64. <Row style={{ margin: '10px', marginBottom: '20px' }}>
  65. <Link
  66. to={`/profile/${_id}`}
  67. className="ModalLink"
  68. onClick={onClick}
  69. key={key}
  70. >
  71. <Col offset={1} className="gutter-row">
  72. {avatar ? (
  73. <Avatar
  74. size={size}
  75. src={backendURL+'/' + avatar?.url}
  76. style={{ marginRight: '3px' }}
  77. />
  78. ) : (
  79. <Avatar size={size} src={user} style={{ marginRight: '3px' }} />
  80. )}
  81. </Col>
  82. <Col offset={2} style={{ marginTop: '5px' }}>
  83. <h3 className='ModalLink'> {login || 'Anon'}</h3>
  84. </Col>
  85. </Link>
  86. {myId == _id ? null : (
  87. <div
  88. style={{
  89. right: '0',
  90. position: 'absolute',
  91. marginRight: '20px',
  92. }}
  93. >
  94. <CSubscribeLinkUser followId={_id} />
  95. </div>
  96. )}
  97. </Row>
  98. )
  99. }
  100. export default LinkToUser