mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
add Fab
This commit is contained in:
1 parent
8c3a17e672
commit
11b9caf611
2 files changed
+21
-18
No files matched your search
@@ -15,20 +15,12 @@ import DocumentList from './list/DoucmentList';
|
||||
import NoteList from './list/NoteList';
|
||||
|
||||
export const NotesApp = () => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const notesApp = useApp('DOCUMENTS');
|
||||
const { setDetail } = useNoteDetail();
|
||||
|
||||
const onClickCreate = () => {
|
||||
setDetail({ title: '', content: '' });
|
||||
history.push('/notes/detail');
|
||||
};
|
||||
const documentsApp = useApp('DOCUMENTS');
|
||||
|
||||
return (
|
||||
<DocumentsThemeProvider>
|
||||
<AppWrapper id="documents-app">
|
||||
<AppTitle app={notesApp} />
|
||||
<AppTitle app={documentsApp} />
|
||||
<Route path="/documents/notes/detail" component={NoteModal} />
|
||||
<AppContent>
|
||||
<Route path="/documents" exact component={DocumentList} />
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
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 { useNotes } from '../hooks/useNotes';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import useStyles from '../documents.styles';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
|
||||
// add search bar later
|
||||
// TODO: Add interface for note
|
||||
@@ -18,14 +19,24 @@ const NoteList = () => {
|
||||
history.push('/documents/notes/detail');
|
||||
};
|
||||
|
||||
const onClickCreate = () => {
|
||||
setDetail({ title: '', content: '' });
|
||||
history.push('/documents/notes/detail');
|
||||
};
|
||||
|
||||
return (
|
||||
<List disablePadding>
|
||||
{notes.map((note) => (
|
||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||
<ListItemText primary={note.title} secondary={`${note.content.slice(0, 35)}...`} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
<div>
|
||||
<List disablePadding>
|
||||
{notes.map((note) => (
|
||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||
<ListItemText primary={note.title} secondary={`${note.content.slice(0, 35)}...`} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
|
||||
<AddIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user