mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 06:28:51 +00:00
fix(notes/nui): sending data from NoteList to the modal
This commit is contained in:
1 parent
4438ee3302
commit
53ef7d0195
1 file changed
+18
-4
@@ -1,13 +1,27 @@
|
||||
import { List } from '@material-ui/core';
|
||||
import React from 'react'
|
||||
import { NoteItem } from './NoteItem';
|
||||
import { List, ListItem, ListItemText } from '@material-ui/core';
|
||||
import React, { useState } from 'react'
|
||||
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
|
||||
// add search bar later
|
||||
const NoteList = ({notes}) => {
|
||||
|
||||
const { noteModal, setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
|
||||
const handleNoteModal = (note) => {
|
||||
setNoteModal(true)
|
||||
setDetail(note)
|
||||
console.log(note.id)
|
||||
}
|
||||
|
||||
return (
|
||||
<List>
|
||||
{notes.map((note) => (
|
||||
<NoteItem key={note.id} {...note} />
|
||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||
<ListItemText><strong>{note.title}</strong></ListItemText>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user