Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev Autor Línea Nro. Línea
2899 stevensc 1
import React, { useMemo } from 'react'
2
import { styled } from '@mui/material'
3
import { REACTIONS } from '@constants/feed'
4
 
2900 stevensc 5
const ReactionsGroup = styled('div')(({ theme }) => ({
2899 stevensc 6
  display: 'flex',
7
  alignItems: 'center',
2900 stevensc 8
  cursor: 'pointer',
9
  '& > svg:not(:first-child)': {
10
    marginLeft: theme.spacing(0.5)
11
  }
2899 stevensc 12
}))
13
 
14
export default function ReactionsIcons({ reactions = [] }) {
15
  const icons = useMemo(
16
    () =>
17
      REACTIONS.filter(({ type }) =>
18
        reactions.some(({ reaction }) => type === reaction)
19
      ),
20
    [reactions]
21
  )
22
 
23
  return (
24
    <ReactionsGroup>
25
      {icons.map(({ icon: Icon, color, label }) => (
26
        <Icon key={label} style={{ color }} />
27
      ))}
28
    </ReactionsGroup>
29
  )
30
}