Created
December 17, 2019 12:13
-
-
Save indreklasn/0c4d2bdd5d209e4379ad764a7499e4fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { memo } from 'react' | |
import { Icon } from 'antd' | |
const NoteList = memo(({data, onRemove, onEdit}) => ( | |
<> | |
{data && data.map(note => ( | |
<div key={note.ref.id} className="note-row"> | |
<p | |
contentEditable | |
suppressContentEditableWarning | |
onChange={e => onEdit(e, note.ref.id, e.currentTarget.textContent)} | |
onBlur={e => onEdit(e, note.ref.id, e.currentTarget.textContent)} | |
onInput={e => onEdit(e, note.ref.id, e.currentTarget.textContent)} | |
> | |
{note.data.text} | |
</p> | |
<Icon | |
onClick={(e) => onRemove(e, note.ref.id)} | |
theme="twoTone" style={{ cursor: "pointer", fontSize: '16px'}} | |
type="delete" | |
/> | |
</div> | |
))} | |
</> | |
)) | |
export default NoteList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment