ListOfUsers.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { ConstructorModal } from '../helpers'
  2. import { ResultUserFind } from './Search_Users'
  3. import React, { useState } from 'react'
  4. export const ListOfUsers = ({
  5. listResult,
  6. listUsers,
  7. onPageData,
  8. text
  9. }) => {
  10. const [isModalVisible, setIsModalVisible] = useState(false)
  11. const showModal = () => {
  12. setIsModalVisible(true)
  13. }
  14. const handleCancel = () => {
  15. setIsModalVisible(false)
  16. }
  17. return (
  18. <>
  19. {listUsers?.length > 0 ? (
  20. <h3
  21. style={{ cursor: 'pointer', marginLeft: '20px' }}
  22. onClick={showModal}
  23. >
  24. {listUsers.length} {text} {' '}
  25. </h3>
  26. ) : (
  27. <h3 style={{ marginLeft: '20px' }}> 0 {text} </h3>
  28. )}
  29. <ConstructorModal
  30. title={text[0].toUpperCase()+ text.slice(1)}
  31. isModalVisible={isModalVisible}
  32. setIsModalVisible={setIsModalVisible}
  33. >
  34. <ResultUserFind
  35. size={'40px'}
  36. onPageData={onPageData}
  37. handleCancel={handleCancel}
  38. userFind={listResult}
  39. />
  40. </ConstructorModal>
  41. </>
  42. )
  43. }
  44. export default ListOfUsers