Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5609 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5609 Rev 6357
Línea 5... Línea 5...
5
import { useForm } from 'react-hook-form'
5
import { useForm } from 'react-hook-form'
6
import { connect } from 'react-redux'
6
import { connect } from 'react-redux'
7
import { addNotification } from '../../../../redux/notification/notification.actions'
7
import { addNotification } from '../../../../redux/notification/notification.actions'
8
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
8
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
9
import FormErrorFeedback from '../../../../shared/form-error-feedback/FormErrorFeedback'
9
import FormErrorFeedback from '../../../../shared/form-error-feedback/FormErrorFeedback'
-
 
10
import useOutsideClick from '../../../../hooks/useOutsideClick'
Línea 10... Línea 11...
10
 
11
 
11
const FeedComments = ({
12
const FeedComments = ({
12
  isShow = true,
13
  isShow = true,
13
  image = '',
14
  image = '',
Línea 117... Línea 118...
117
    comment: content,
118
    comment: content,
118
    link_delete,
119
    link_delete,
119
  } = comment
120
  } = comment
120
  const [showConfirmModal, setShowConfirmModal] = useState(false)
121
  const [showConfirmModal, setShowConfirmModal] = useState(false)
121
  const [displayOption, setDisplayOption] = useState(false)
122
  const [displayOption, setDisplayOption] = useState(false)
122
  const deleteButton = useRef()
123
  const deleteButton = useRef(null)
-
 
124
  const outsideClick = useOutsideClick(deleteButton)
Línea 123... Línea 125...
123
 
125
 
Línea 124... Línea 126...
124
  const toggleModal = () => setShowConfirmModal(!showConfirmModal)
126
  const toggleModal = () => setShowConfirmModal(!showConfirmModal)
125
 
-
 
126
  useEffect(() => {
-
 
127
    const handleClickOutside = (event) => {
127
 
128
      if (
-
 
129
        deleteButton.current &&
-
 
130
        !deleteButton.current.contains(event.target)
128
  useEffect(() => {
131
      ) {
-
 
132
        setDisplayOption(false)
-
 
133
      }
-
 
134
    }
-
 
135
    document.addEventListener('mousedown', handleClickOutside)
-
 
136
 
-
 
137
    return () => {
-
 
138
      document.removeEventListener('mousedown', handleClickOutside)
129
    if (!outsideClick) return
Línea 139... Línea 130...
139
    }
130
    setDisplayOption(false)
140
  }, [deleteButton])
131
  }, [outsideClick])
141
 
132
 
142
  return (
133
  return (