ModalLikes.jsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { useState } from 'react'
  2. import { ConstructorModal } from '../../helpers'
  3. import LikeList from './LikeList'
  4. import { Col } from 'antd'
  5. const ModalLikes = ({ likes, myId }) => {
  6. const [isModalVisible, setIsModalVisible] = useState(false)
  7. const showModal = () => {
  8. setIsModalVisible(true)
  9. }
  10. return (
  11. <>
  12. <Col
  13. xl={{ span: 15, offset: 0 }}
  14. lg={{ span: 10, offset: 0 }}
  15. sm={{ offset: 0, span: 10 }}
  16. xs={{ offset: 1, span: 20 }}
  17. >
  18. {likes.length ?
  19. (
  20. <h3 className="LikeStyle"
  21. style={{ margin: '0 auto' }}
  22. onClick={showModal}>
  23. {' '}
  24. {likes.length} likes
  25. </h3>
  26. ) : (
  27. <h3 className="LikeStyle"> 0 likes</h3>
  28. )}
  29. <ConstructorModal
  30. title={'Likes'}
  31. isModalVisible={isModalVisible}
  32. setIsModalVisible={setIsModalVisible}
  33. >
  34. <LikeList likes={likes} myId={myId} />
  35. </ConstructorModal>
  36. </Col>
  37. </>
  38. )
  39. }
  40. export default ModalLikes