This commit is contained in:
Christopher committed 2021-03-16 12:02:07 +01:00
1 parent 8c3a17e672
commit 11b9caf611
2 files changed
+14 -11

No files matched your search

+2 -10
View File
@@ -15,20 +15,12 @@ import DocumentList from './list/DoucmentList';
import NoteList from './list/NoteList'; import NoteList from './list/NoteList';
export const NotesApp = () => { export const NotesApp = () => {
const classes = useStyles(); const documentsApp = useApp('DOCUMENTS');
const history = useHistory();
const notesApp = useApp('DOCUMENTS');
const { setDetail } = useNoteDetail();
const onClickCreate = () => {
setDetail({ title: '', content: '' });
history.push('/notes/detail');
};
return ( return (
<DocumentsThemeProvider> <DocumentsThemeProvider>
<AppWrapper id="documents-app"> <AppWrapper id="documents-app">
<AppTitle app={notesApp} /> <AppTitle app={documentsApp} />
<Route path="/documents/notes/detail" component={NoteModal} /> <Route path="/documents/notes/detail" component={NoteModal} />
<AppContent> <AppContent>
<Route path="/documents" exact component={DocumentList} /> <Route path="/documents" exact component={DocumentList} />
+12 -1
View File
@@ -1,9 +1,10 @@
import React from 'react'; import React from 'react';
import { List, ListItem, ListItemText } from '@material-ui/core'; import { Fab, List, ListItem, ListItemText } from '@material-ui/core';
import { useNoteDetail } from '../hooks/useNoteDetail'; import { useNoteDetail } from '../hooks/useNoteDetail';
import { useNotes } from '../hooks/useNotes'; import { useNotes } from '../hooks/useNotes';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import useStyles from '../documents.styles'; import useStyles from '../documents.styles';
import AddIcon from '@material-ui/icons/Add';
// add search bar later // add search bar later
// TODO: Add interface for note // TODO: Add interface for note
@@ -18,7 +19,13 @@ const NoteList = () => {
history.push('/documents/notes/detail'); history.push('/documents/notes/detail');
}; };
const onClickCreate = () => {
setDetail({ title: '', content: '' });
history.push('/documents/notes/detail');
};
return ( return (
<div>
<List disablePadding> <List disablePadding>
{notes.map((note) => ( {notes.map((note) => (
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}> <ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
@@ -26,6 +33,10 @@ const NoteList = () => {
</ListItem> </ListItem>
))} ))}
</List> </List>
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
<AddIcon />
</Fab>
</div>
); );
}; };