fix(phone): move FABs outside of AppContent

This commit is contained in:
Christopher authored and Taso committed 2021-06-08 15:47:19 -04:00
1 parent 3df2f88759
commit 10639260e0
4 files changed
+23 -33

No files matched your search

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