Refactored Contacts to use Routes and not a Modal (#80)

The new route allows for other components to directly route to contacts/:id, where id is the contact id for a users given contacts. It also adds a getContact function accessible by the useConfig hook in case a contact needs to be retrieved using a contact id.
This commit is contained in:
Taso authored and GitHub committed 2021-02-09 09:59:54 -05:00
1 parent eaf27f37ef
commit c0509be2d1
14 files changed
+324 -453

No files matched your search

@@ -0,0 +1,39 @@
import React from 'react';
import { ContactList } from '../List/ContactList';
import Fab from '@material-ui/core/Fab';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { ContactAlert } from '../alert/ContactAlert';
import { useHistory } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({
absolute: {
position: 'absolute',
bottom: theme.spacing(2),
right: theme.spacing(2),
},
icon: {
color: '#fff',
fontSize: 30,
},
}));
export const ContactPage = () => {
const history = useHistory();
const classes = useStyles();
return (
<>
<ContactList />
<Fab
onClick={() => history.push('/contacts/add')}
style={{ backgroundColor: '#2196f3', color: '#fff' }}
className={classes.absolute}
>
<PersonAddIcon />
</Fab>
<ContactAlert />
</>
);
};