Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5669 | Rev 5734 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5577 stevensc 1
import React, { useState } from 'react'
2
import RecommendIcon from '@mui/icons-material/Recommend'
3
import FavoriteIcon from '@mui/icons-material/Favorite'
4
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
5574 stevensc 5
 
5667 stevensc 6
export const ReactionButton = () => {
5668 stevensc 7
  const [settedReaction, setSettedReaction] = useState('r')
5667 stevensc 8
 
9
  const reactions = [
10
    {
11
      type: 'r',
5668 stevensc 12
      icon: <RecommendIcon />,
5667 stevensc 13
    },
14
    {
15
      type: 'f',
5668 stevensc 16
      icon: <FavoriteIcon />,
5667 stevensc 17
    },
18
    {
19
      type: 'v',
5668 stevensc 20
      icon: <VolunteerActivismIcon />,
5667 stevensc 21
    },
22
  ]
23
 
5577 stevensc 24
  return (
5667 stevensc 25
    <button type="button" className="reaction-btn">
5577 stevensc 26
      <div className="reactions-list">
5669 stevensc 27
        {reactions.map((reaction) => (
28
          <button
29
            key={reaction.type}
5670 stevensc 30
            onClick={() => setSettedReaction(reaction.type)}
5669 stevensc 31
          >
32
            {reaction.icon}
33
          </button>
34
        ))}
5577 stevensc 35
      </div>
5668 stevensc 36
      {reactions.map((reaction) =>
37
        reaction.type === settedReaction ? reaction.icon : null
38
      )}
5577 stevensc 39
    </button>
40
  )
41
}