Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2160 Rev 2161
Línea 17... Línea 17...
17
  display: 'flex',
17
  display: 'flex',
18
  padding: 1,
18
  padding: 1,
19
  width: 'fit-content',
19
  width: 'fit-content',
20
  borderRadius: theme.shape.borderRadius,
20
  borderRadius: theme.shape.borderRadius,
21
  transform: 'scale(0)',
21
  transform: 'scale(0)',
22
  transformOrigin: 'left bottom',
22
  transformOrigin: 'center',
23
  transition: theme.transitions.create('transform', {
23
  transition: theme.transitions.create('transform', {
24
    duration: theme.transitions.duration.short,
24
    duration: theme.transitions.duration.short,
25
    easing: theme.transitions.easing.easeInOut,
25
    easing: theme.transitions.easing.easeInOut,
26
    delay: theme.transitions.duration.short
26
    delay: theme.transitions.duration.short
27
  }),
27
  }),
Línea 39... Línea 39...
39
    }
39
    }
40
  }
40
  }
41
}))
41
}))
Línea 42... Línea 42...
42
 
42
 
43
export default function withReactions(Component) {
43
export default function withReactions(Component) {
44
  const HOC = ({
44
  const ReactionsButton = ({
45
    saveUrl = '',
45
    saveUrl = '',
46
    deleteUrl = '',
46
    deleteUrl = '',
47
    currentReactionType = null,
47
    currentReactionType = null,
48
    onReaction = () => null
48
    onReaction = () => null
49
  }) => {
49
  }) => {
50
    const [isHover, setIsHover] = useState(false)
50
    const [isHover, setIsHover] = useState(false)
51
    const debounceHover = useDebounce(isHover, 500)
51
    const debounceHover = useDebounce(isHover, 500)
Línea 52... Línea 52...
52
    const dispatch = useDispatch()
52
    const dispatch = useDispatch()
53
 
53
 
54
    const currentReaction = useMemo(() => {
-
 
55
      const reaction = REACTIONS.find((r) => r.type === currentReactionType)
54
    const currentReaction = useMemo(
56
      console.log(reaction)
55
      () => REACTIONS.find((r) => r.type === currentReactionType),
57
      console.log(currentReactionType)
-
 
58
      return reaction
56
      [currentReactionType]
Línea 59... Línea 57...
59
    }, [currentReactionType])
57
    )
60
    const Icon = currentReaction ? currentReaction.icon : REACTIONS[0].icon
58
    const Icon = currentReaction ? currentReaction.icon : REACTIONS[0].icon
61
 
59
 
Línea 71... Línea 69...
71
            dispatch(addNotification({ style: 'danger', msg: data }))
69
            dispatch(addNotification({ style: 'danger', msg: data }))
72
          }
70
          }
Línea 73... Línea 71...
73
 
71
 
74
          onReaction({
72
          onReaction({
75
            reactions: data.reactions,
73
            reactions: data.reactions,
76
            currentReactionType: type
74
            currentReaction: type
77
          })
75
          })
78
        })
76
        })
79
      },
77
      },
80
      [saveUrl, dispatch]
78
      [saveUrl, dispatch]
Línea 128... Línea 126...
128
        </ReactionsBox>
126
        </ReactionsBox>
129
      </Component>
127
      </Component>
130
    )
128
    )
131
  }
129
  }
Línea 132... Línea 130...
132
 
130
 
133
  return HOC
131
  return ReactionsButton