Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2153 Rev 2775
Línea 1... Línea 1...
1
import React, { useRef, useState, useEffect } from 'react'
1
import React, { useState, useEffect } from 'react'
2
import { useDispatch } from 'react-redux'
2
import { useDispatch } from 'react-redux'
Línea 3... Línea 3...
3
 
3
 
4
import { axios, debounce } from '../../../utils'
4
import { axios, debounce } from '../../../utils'
Línea 5... Línea 5...
5
import useOutsideClick from '../../../hooks/useOutsideClick'
5
import { useOutsideClick } from '@hooks'
6
 
6
 
Línea 7... Línea 7...
7
import { REACTIONS } from '@app/constants/feed'
7
import { REACTIONS } from '@app/constants/feed'
Línea 15... Línea 15...
15
  deleteUrl,
15
  deleteUrl,
16
  ...rest
16
  ...rest
17
}) => {
17
}) => {
18
  const [reaction, setReaction] = useState(null)
18
  const [reaction, setReaction] = useState(null)
19
  const [isHover, setIsHover] = useState(false)
19
  const [isHover, setIsHover] = useState(false)
20
  const rectionBtn = useRef(null)
-
 
21
  const dispatch = useDispatch()
20
  const dispatch = useDispatch()
Línea 22... Línea 21...
22
 
21
 
Línea 23... Línea 22...
23
  useOutsideClick(rectionBtn, () => setIsHover(false))
22
  const [ref] = useOutsideClick(() => setIsHover(false))
24
 
23
 
25
  const saveReaction = (type) => {
24
  const saveReaction = (type) => {
Línea 65... Línea 64...
65
    <>
64
    <>
66
      <button
65
      <button
67
        {...rest}
66
        {...rest}
68
        onMouseOver={onHover}
67
        onMouseOver={onHover}
69
        onMouseOut={onUnhover}
68
        onMouseOut={onUnhover}
70
        ref={rectionBtn}
69
        ref={ref}
71
        onClick={() =>
70
        onClick={() =>
72
          reaction.type !== 'default'
71
          reaction.type !== 'default'
73
            ? deleteReaction()
72
            ? deleteReaction()
74
            : saveReaction(REACTIONS[0].type)
73
            : saveReaction(REACTIONS[0].type)
75
        }
74
        }