Skip to content

Instantly share code, notes, and snippets.

@jamestthompson3
Created June 3, 2018 14:30
Show Gist options
  • Save jamestthompson3/9e33feca7fb966852a2bc7c65e6a062f to your computer and use it in GitHub Desktop.
Save jamestthompson3/9e33feca7fb966852a2bc7c65e6a062f to your computer and use it in GitHub Desktop.
const LikesList = ({
user: { likes, user },
updateFunctions: { addLike, deleteLike },
isOpen,
text,
handleChange,
toggleModal
}) => (
<Fragment>
<ListHeader>
<h3 style={{ margin: 0 }}>Likes</h3>
<i className="material-icons" style={{ cursor: 'pointer' }} onClick={toggleModal}>
add
</i>
</ListHeader>
<LikesContainer style={{ marginBottom: 20 }}>
<AddPopup
open={isOpen}
onChange={handleChange}
handleSubmit={() => addLike(user, text)}
closeModal={toggleModal}
text={text}
/>
{likes.map(like => (
<ListItem open={isOpen} key={like.item + like.id}>
{like.item}
<i className="material-icons" onClick={() => deleteLike(user, like)}>
delete
</i>
</ListItem>
))}
</LikesContainer>
</Fragment>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment