mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +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 { List, ListItem, ListItemText } from '@material-ui/core';
|
||||||
import React from 'react'
|
import React, { useState } from 'react'
|
||||||
import { NoteItem } from './NoteItem';
|
|
||||||
|
import { useNoteModal } from '../hooks/useNoteModal';
|
||||||
|
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||||
|
|
||||||
// add search bar later
|
// add search bar later
|
||||||
const NoteList = ({notes}) => {
|
const NoteList = ({notes}) => {
|
||||||
|
|
||||||
|
const { noteModal, setNoteModal } = useNoteModal();
|
||||||
|
const { detail, setDetail } = useNoteDetail();
|
||||||
|
|
||||||
|
const handleNoteModal = (note) => {
|
||||||
|
setNoteModal(true)
|
||||||
|
setDetail(note)
|
||||||
|
console.log(note.id)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
{notes.map((note) => (
|
{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>
|
</List>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user