Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
Cómo pasar el icono MUI en una lista de mapas

Primero, importé el ícono AccountCircle de MUI:

 import { AccountCircle } from '@mui/icons-material';

Y usé estilo para darle estilo al ícono:

 const UserIcon = styled(AccountCircle)({ margin: '0px 0px 0px 0px', });

Y mi función de exportación se ve así:

 export default function Notifications() { const dummyNotification = [ 'Notification #1', 'Notification #2', 'Notification #3', ]; const cardComponents = dummyNotification !== undefined ? dummyNotification.map((notification) => ( <div key={notification}> <div> <GreenBox>{notification}</GreenBox> </div> </div> )) : 'Loading...'; return ( <> <NavBar /> <Row> <RightCol> <div>{cardComponents}</div> </RightCol> </Row> </> ); }

Esto es lo que parece cuando lo ejecuto: ingrese la descripción de la imagen aquí

He escrito dummyNotification como una lista de cadenas, y lo mapeo para que la notificación sea cada cadena en la lista. Quiero agregar un ícono de usuario (AcountCircle) en GreenBox antes de "Notificación __" para cada uno de los 3 cuadros. ¿Cómo haría eso aquí? Gracias de antemano.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

function Notifications() { const dummyNotification = [ {notif: 'Notification #1', icon: UserIcon }, {notif: 'Notification #2', icon: UserIcon }, {notif: 'Notification #3', icon: UserIcon }, ]; const cardComponents = dummyNotification !== undefined ? dummyNotification.map((notification) => ( <div key={notification.notif}> <div> <GreenBox> <notification.UserIcon/ > {notification.notif} </GreenBox> </div> </div> )) : 'Loading...'; return ( <> <NavBar /> <Row> <RightCol> <div>{cardComponents}</div> </RightCol> </Row> </> ); }
about 4 years ago · Juan Pablo Isaza Denunciar

0

Si solo desea el ícono AccountCircle, puede codificar el ícono como <GreenBox><AcccountCircle /> {notification}</GreenBox> o si desea diferentes íconos para diferentes notificaciones, puede hacer algo como esto.

 export default function ControlledSwitches() { const UserIcon = styled(AccountCircle)({ margin: "0px 0px 0px 0px" }); const dummyNotification = [ { text: "Notification #1", icon: <UserIcon /> }, { text: "Notification #2", icon: <UserIcon /> }, { text: "Notification #3", icon: <UserIcon /> } ]; const cardComponents = dummyNotification !== undefined ? dummyNotification.map((notification) => ( <div key={notification}> <div> <GreenBox> {notification.icon} {notification.text} </GreenBox> </div> </div> )) : "Loading..."; return ( <> <NavBar /> <Row> <RightCol> <div>{cardComponents}</div> </RightCol> </Row> </> ); }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda