import React from "react"; import PropTypes from "prop-types"; import { AVATAR_LIST } from "../../constants"; const Avatars = ({ handleAvatarClick, currentAvatar }) => { return ( <> {AVATAR_LIST.map((avatar) => { const selected = avatar.name === currentAvatar ? " selected" : ""; return (
{avatar.image} handleAvatarClick(e, avatar.name)} /> {selected && (
)}
); })} ); }; Avatars.propTypes = { currentAvatar: PropTypes.string, handleAvatarClick: PropTypes.func, }; export default Avatars;