Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: minimal implementation of go back button #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/polyflix/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"delete": "delete",
"closeModal": "Close modal",
"report": "report",
"seeMore": "See more"
"seeMore": "See more",
"goBack": "Go back"
},
"navbar": {
"tooltip": {
Expand Down Expand Up @@ -102,4 +103,4 @@
"typeHere": "Please input here..."
}
}
}
}
5 changes: 3 additions & 2 deletions apps/polyflix/public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"delete": "supprimer",
"report": "signaler",
"closeModal": "Fermer la modale",
"seeMore": "Voir Plus"
"seeMore": "Voir Plus",
"goBack": "Retour"
},
"navbar": {
"tooltip": {
Expand Down Expand Up @@ -98,4 +99,4 @@
"typeHere": "Veuillez saisir ici..."
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import {
ListItemText,
Stack,
Tooltip,
Typography,
useTheme,
} from '@mui/material'
import Box from '@mui/material/Box'
import React, { PropsWithChildren, useEffect } from 'react'
import { Link as RouterLink, useLocation } from 'react-router-dom'
import { Link as RouterLink, useLocation, useHistory } from 'react-router-dom'

import { Icon } from '@core/components/Icon/Icon.component'
import { Logo } from '@core/components/Logo/Logo.component'
Expand Down Expand Up @@ -70,6 +71,11 @@ export const DashboardNavbar: React.FC<PropsWithChildren<{}>> = () => {
}
}, [])

const history = useHistory()
const goBack = () => {
history.goBack()
}

return (
<RootStyle>
<ToolbarStyle ref={toolBarRef}>
Expand Down Expand Up @@ -100,6 +106,20 @@ export const DashboardNavbar: React.FC<PropsWithChildren<{}>> = () => {
<Icon name="eva:menu-fill" />
</Box>
<Logo />
<Typography
variant="caption"
sx={{
color: 'grey.500',
alignSelf: 'center',
paddingX: 2,
cursor: 'pointer',
fontSize: '0.8rem',
textTransform: 'uppercase',
}}
onClick={goBack}
>
{t('actions.goBack')}
</Typography>
<Box sx={{ flexGrow: 1 }} />
<Stack
direction="row"
Expand Down