Skip to content

Commit

Permalink
feat: minimal implementation of go back button
Browse files Browse the repository at this point in the history
  • Loading branch information
leofvo committed Feb 17, 2023
1 parent c5b39bc commit 36e6539
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
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 @@ -97,4 +98,4 @@
"informations": "Activate the dark mode to preserve your eyes."
}
}
}
}
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 @@ -93,4 +94,4 @@
"informations": "Activer le mode sombre pour préserver vos yeux."
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { ManageSearch, Person, Settings } from '@mui/icons-material'
import {
Button,
IconButton,
List,
ListItemButton,
ListItemIcon,
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 +72,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 +107,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

0 comments on commit 36e6539

Please sign in to comment.