mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
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:
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 />
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user