123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import user from '../materials/user.png'
- import { Link } from 'react-router-dom'
- import { Avatar, Col, Row } from 'antd'
- import { CSubscribeLinkUser } from '../components/Subscribe'
- import backendURL from '../helpers/backendUrl'
- export const LinkToUser = ({
- _id,
- avatar,
- login,
- size,
- font = '15px',
- padding = '10px',
- onClick,
- key,
- }) => {
- return (
- <Row style={{ marginBottom:'5px'}}>
- <Link
- to={`/profile/${_id}`}
- style={{
- display: 'flex',
- padding: padding,
- flexDirection: 'row',
- fontSize: font,
- fontWeight: 'bold',
- color: 'black'
- }}
- onClick={onClick}
- key={key}
- >
- <Col offset={1} className="gutter-row">
- {avatar ? (
- <Avatar
- size={size}
- src={backendURL+'/' + avatar?.url}
-
- />
- ) : (
- <Avatar size={size} src={user}
- // style={{ marginRight: '3px' }}
- />
- )}
- </Col>
- <Col offset={3} style={{ marginTop: '5px' }}>
- <h3> {login || 'Anon'}</h3>
- </Col>
- </Link>
- </Row>
- )
- }
- export const LinkWithSubscribe = ({
- _id,
- avatar,
- login,
- size,
- font = '15px',
- padding = '10px',
- onClick,
- key,
- myId,
- }) => {
- return (
- <Row style={{ margin: '10px', marginBottom: '20px' }}>
- <Link
- to={`/profile/${_id}`}
- style={{
- display: 'flex',
- padding: padding,
- flexDirection: 'row',
- fontSize: font,
- fontWeight: 'bold',
- color: 'black'
- }}
- onClick={onClick}
- key={key}
- >
- <Col offset={1} className="gutter-row">
- {avatar ? (
- <Avatar
- size={size}
- src={backendURL+'/' + avatar?.url}
- style={{ marginRight: '3px' }}
- />
- ) : (
- <Avatar size={size} src={user} style={{ marginRight: '3px' }} />
- )}
- </Col>
- <Col offset={2} style={{ marginTop: '5px' }}>
- <h3> {login || 'Anon'}</h3>
- </Col>
- </Link>
- {myId == _id ? null : (
- <div
- style={{
- right: '0',
- position: 'absolute',
- marginRight: '20px',
- }}
- >
- <CSubscribeLinkUser followId={_id} />
- </div>
- )}
- </Row>
- )
- }
- export default LinkToUser
|