Phone navigation button

This commit is contained in:
J Francisco Rader committed 2020-08-22 21:56:12 -03:00
1 parent d1c7e61b30
commit d36ef4ce38
1 file changed
+9 -6
+9 -6
View File
@@ -6,6 +6,7 @@ import {
} from "@material-ui/core"; } from "@material-ui/core";
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft"; import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
import AppsIcon from "@material-ui/icons/Apps"; import AppsIcon from "@material-ui/icons/Apps";
import PhoneIcon from "@material-ui/icons/Phone";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
@@ -18,24 +19,26 @@ const useStyles = makeStyles((theme) => ({
export const Navigation = () => { export const Navigation = () => {
const classes = useStyles(); const classes = useStyles();
const history = useHistory(); const history = useHistory();
return ( return (
<BottomNavigation <BottomNavigation
className={classes.root} className={classes.root}
onChange={(_e, value) => onChange={(_e, value) => value()}
value === "back" ? history.goBack() : history.push("/")
}
> >
<BottomNavigationAction <BottomNavigationAction
label="Back" label="Back"
value="back" value={() => history.goBack()}
icon={<KeyboardArrowLeftIcon />} icon={<KeyboardArrowLeftIcon />}
/> />
<BottomNavigationAction <BottomNavigationAction
label="Home" label="Home"
value="home" value={() => history.push('/')}
icon={<AppsIcon className={classes.icon} />} icon={<AppsIcon className={classes.icon} />}
/> />
<BottomNavigationAction
label="Phone"
value={() => history.push('/phone')}
icon={<PhoneIcon className={classes.icon} />}
/>
</BottomNavigation> </BottomNavigation>
); );
}; };