From 1940833f564409199cf94c2f826baafb610e51a8 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 8 Jun 2021 20:45:12 +0200 Subject: [PATCH] fix(phone): move FABs outside of AppContent --- .../apps/contacts/components/ContactsApp.tsx | 21 +++++++++++++ .../components/views/ContactsPage.tsx | 31 ++----------------- phone/src/apps/notes/NotesApp.tsx | 6 ++-- phone/src/apps/notes/notes.styles.ts | 2 +- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/phone/src/apps/contacts/components/ContactsApp.tsx b/phone/src/apps/contacts/components/ContactsApp.tsx index bc4f685..6419eb1 100644 --- a/phone/src/apps/contacts/components/ContactsApp.tsx +++ b/phone/src/apps/contacts/components/ContactsApp.tsx @@ -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 ( @@ -22,6 +36,13 @@ export const ContactsApp = () => { + history.push('/contacts/-1')} + className={classes.absolute} + > + + ); diff --git a/phone/src/apps/contacts/components/views/ContactsPage.tsx b/phone/src/apps/contacts/components/views/ContactsPage.tsx index d072f30..204a803 100644 --- a/phone/src/apps/contacts/components/views/ContactsPage.tsx +++ b/phone/src/apps/contacts/components/views/ContactsPage.tsx @@ -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 ( - <> +
- history.push('/contacts/-1')} - className={classes.absolute} - > - - - +
); }; diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index 85d7c50..ddf5b1c 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -30,10 +30,10 @@ export const NotesApp = () => { - - - + + + ); diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts index 71b03e3..ed1fd52 100644 --- a/phone/src/apps/notes/notes.styles.ts +++ b/phone/src/apps/notes/notes.styles.ts @@ -13,8 +13,8 @@ const useStyles = makeStyles((theme) => ({ }, absolute: { position: 'absolute', - bottom: theme.spacing(2), right: theme.spacing(3), + bottom: theme.spacing(5), }, }));