all repos — caroster @ 950135f2eab0a867b64817264cb349b56d93865c

[Octree] Group carpool to your event https://caroster.io

fixup! add an arrow-left to go back in profile page
Hadrien Froger hadrien@octree.ch
Fri, 14 Aug 2020 08:44:10 +0100
commit

950135f2eab0a867b64817264cb349b56d93865c

parent

45b2ee77c9620ec89b3a2c8100cda1640cc2be74

3 files changed, 16 insertions(+), 13 deletions(-)

jump to
M app/src/containers/GenericMenu/index.jsapp/src/containers/GenericMenu/index.js

@@ -1,4 +1,4 @@

-import React, {useState, useEffect, useMemo, useCallback} from 'react'; +import React, {useState, useEffect, useMemo} from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography';

@@ -9,7 +9,7 @@ import GenericToolbar from './Toolbar';

import {useTranslation} from 'react-i18next'; import {useStrapi} from 'strapi-react-context'; import {useHistory} from 'react-router-dom'; -const GenericMenu = ({title, actions = []}) => { +const GenericMenu = ({title, actions = [], goBack = false}) => { const {t} = useTranslation(); const history = useHistory(); const [anchorEl, setAnchorEl] = useState(null);

@@ -35,15 +35,17 @@ className={classes.appbar}

id="Menu" > <Toolbar> - <IconButton - edge="start" - className={classes.goBack} - onClick={() => - history.length > 2 ? history.goBack() : history.push('/dashboard') - } - > - <Icon>arrow_back</Icon> - </IconButton> + {goBack && ( + <IconButton + edge="start" + className={classes.goBack} + onClick={() => + history.length > 2 ? history.goBack() : history.push('/dashboard') + } + > + <Icon>arrow_back</Icon> + </IconButton> + )} <div className={classes.name}> <Typography variant="h6" noWrap id="MenuHeaderTitle"> {title}
M app/src/layouts/Default.jsapp/src/layouts/Default.js

@@ -6,11 +6,12 @@ children,

className, menuTitle = 'Caroster', menuActions, + goBack = false, }) => { return ( <> {(menuTitle || menuActions) && ( - <GenericMenu title={menuTitle} actions={menuActions} /> + <GenericMenu title={menuTitle} actions={menuActions} goBack={goBack} /> )} <div className={className}>{children}</div> </>
M app/src/pages/Profile.jsapp/src/pages/Profile.js

@@ -34,7 +34,7 @@

if (!profile) return <Loading />; return ( - <Layout menuTitle={t('profile.title')} menuActions={menuActions}> + <Layout menuTitle={t('profile.title')} menuActions={menuActions} goBack> <Profile profile={profile} updateProfile={updateProfile}