mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +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';
|
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} />
|
||||||
|
|||||||
@@ -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,14 +19,24 @@ const NoteList = () => {
|
|||||||
history.push('/documents/notes/detail');
|
history.push('/documents/notes/detail');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClickCreate = () => {
|
||||||
|
setDetail({ title: '', content: '' });
|
||||||
|
history.push('/documents/notes/detail');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List disablePadding>
|
<div>
|
||||||
{notes.map((note) => (
|
<List disablePadding>
|
||||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
{notes.map((note) => (
|
||||||
<ListItemText primary={note.title} secondary={`${note.content.slice(0, 35)}...`} />
|
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||||
</ListItem>
|
<ListItemText primary={note.title} secondary={`${note.content.slice(0, 35)}...`} />
|
||||||
))}
|
</ListItem>
|
||||||
</List>
|
))}
|
||||||
|
</List>
|
||||||
|
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
|
||||||
|
<AddIcon />
|
||||||
|
</Fab>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user