fix(phone): move FABs outside of AppContent

This commit is contained in:
Christopher committed 2021-06-08 20:45:12 +02:00
1 parent 54d456cc8a
commit 1940833f56
4 files changed
+27 -33

No files matched your search

@@ -10,9 +10,23 @@ import ContactsInfoPage from './views/ContactInfo';
import { ContactPage } from './views/ContactsPage';
import { ContactsThemeProvider } from '../providers/ContactsThemeProvider';
import { ContactEvents } from '../../../../../typings/contact';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import Fab from '@material-ui/core/Fab';
import { useHistory } from 'react-router';
import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({
absolute: {
position: 'absolute',
right: theme.spacing(3),
bottom: theme.spacing(2),
},
}));
export const ContactsApp = () => {
const contacts = useApp('CONTACTS');
const history = useHistory();
const classes = useStyles();
return (
<ContactsThemeProvider>
@@ -22,6 +36,13 @@ export const ContactsApp = () => {
<Route path="/contacts/" exact component={ContactPage} />
<Route path="/contacts/:id" exact component={ContactsInfoPage} />
</AppContent>
<Fab
color="primary"
onClick={() => history.push('/contacts/-1')}
className={classes.absolute}
>
<PersonAddIcon />
</Fab>
</AppWrapper>
</ContactsThemeProvider>
);
@@ -1,37 +1,10 @@
import React from 'react';
import Fab from '@material-ui/core/Fab';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { useHistory } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { ContactList } from '../List/ContactList';
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 (
<>
<div style={{ paddingBottom: 60 }}>
<ContactList />
<Fab
color="primary"
onClick={() => history.push('/contacts/-1')}
className={classes.absolute}
>
<PersonAddIcon />
</Fab>
</>
</div>
);
};
+3 -3
View File
@@ -30,10 +30,10 @@ export const NotesApp = () => {
<NoteModal />
<AppContent>
<Route path="/notes" component={NoteList} />
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
<AddIcon />
</Fab>
</AppContent>
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
<AddIcon />
</Fab>
</AppWrapper>
</NotesThemeProvider>
);
+1 -1
View File
@@ -13,8 +13,8 @@ const useStyles = makeStyles((theme) => ({
},
absolute: {
position: 'absolute',
bottom: theme.spacing(2),
right: theme.spacing(3),
bottom: theme.spacing(5),
},
}));