import { Card, Col, Row, Carousel, Empty, Button } from 'antd' import React, { createRef, useEffect, useState } from 'react' import { connect } from 'react-redux' import { Link } from 'react-router-dom' import { backURL } from '../../helpers' import { UserAvatar } from '../header/Header' import nodata from '../../images/nodata.png' import { HeartFilled, HeartOutlined, LeftCircleOutlined, RightCircleOutlined, SendOutlined, } from '@ant-design/icons' import Paragraph from 'antd/lib/typography/Paragraph' import Text from 'antd/lib/typography/Text' import TextArea from 'antd/lib/input/TextArea' import { actionDelLikePost, actionFullAddComment, actionLikePost, actionPostsFeed, actionRemovePostsFeedAC } from '../../actions' const PostTitle = ({ owner }) => {owner?.nick ? owner.nick : owner?.login ? owner.login : 'Null'} class PostImage extends React.Component { constructor(props) { super(props); this.carouselRef = createRef(); this.state = { movePrev: false, moveNext: false } } handleNext = () => this.carouselRef.current.next(this); handlePrev = () => this.carouselRef.current.prev(this); moveOnDivArray = (length, index) => { if (length === 1) { this.setState({ movePrev: false, moveNext: false }) } else if (index === 0) { this.setState({ movePrev: false, moveNext: true }) } else if (index === length - 1 && length > 1) { this.setState({ movePrev: true, moveNext: false }) } else { this.setState({ movePrev: true, moveNext: true }) } } downOnDivArray = () => this.setState({ movePrev: false, moveNext: false }) render() { const { images } = this.props return ( {!!images ? images.map((i, index) => i?.url ?
this.moveOnDivArray(images.length, index)} onMouseLeave={this.downOnDivArray}>
: ) : }
); } } const HeartLike = ({ styleFontSize, likeStatus, changeLike }) =>