Skip to content

Commit 36e6539

Browse files
committed
feat: minimal implementation of go back button
1 parent c5b39bc commit 36e6539

3 files changed

Lines changed: 28 additions & 5 deletions

File tree

apps/polyflix/public/locales/en/common.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"delete": "delete",
2929
"closeModal": "Close modal",
3030
"report": "report",
31-
"seeMore": "See more"
31+
"seeMore": "See more",
32+
"goBack": "Go back"
3233
},
3334
"navbar": {
3435
"tooltip": {
@@ -97,4 +98,4 @@
9798
"informations": "Activate the dark mode to preserve your eyes."
9899
}
99100
}
100-
}
101+
}

apps/polyflix/public/locales/fr/common.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"delete": "supprimer",
2929
"report": "signaler",
3030
"closeModal": "Fermer la modale",
31-
"seeMore": "Voir Plus"
31+
"seeMore": "Voir Plus",
32+
"goBack": "Retour"
3233
},
3334
"navbar": {
3435
"tooltip": {
@@ -93,4 +94,4 @@
9394
"informations": "Activer le mode sombre pour préserver vos yeux."
9495
}
9596
}
96-
}
97+
}

apps/polyflix/src/modules/core/components/Dashboard/Navbar/Navbar.component.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { ManageSearch, Person, Settings } from '@mui/icons-material'
22
import {
3+
Button,
34
IconButton,
45
List,
56
ListItemButton,
67
ListItemIcon,
78
ListItemText,
89
Stack,
910
Tooltip,
11+
Typography,
1012
useTheme,
1113
} from '@mui/material'
1214
import Box from '@mui/material/Box'
1315
import React, { PropsWithChildren, useEffect } from 'react'
14-
import { Link as RouterLink, useLocation } from 'react-router-dom'
16+
import { Link as RouterLink, useLocation, useHistory } from 'react-router-dom'
1517

1618
import { Icon } from '@core/components/Icon/Icon.component'
1719
import { Logo } from '@core/components/Logo/Logo.component'
@@ -70,6 +72,11 @@ export const DashboardNavbar: React.FC<PropsWithChildren<{}>> = () => {
7072
}
7173
}, [])
7274

75+
const history = useHistory()
76+
const goBack = () => {
77+
history.goBack()
78+
}
79+
7380
return (
7481
<RootStyle>
7582
<ToolbarStyle ref={toolBarRef}>
@@ -100,6 +107,20 @@ export const DashboardNavbar: React.FC<PropsWithChildren<{}>> = () => {
100107
<Icon name="eva:menu-fill" />
101108
</Box>
102109
<Logo />
110+
<Typography
111+
variant="caption"
112+
sx={{
113+
color: 'grey.500',
114+
alignSelf: 'center',
115+
paddingX: 2,
116+
cursor: 'pointer',
117+
fontSize: '0.8rem',
118+
textTransform: 'uppercase',
119+
}}
120+
onClick={goBack}
121+
>
122+
{t('actions.goBack')}
123+
</Typography>
103124
<Box sx={{ flexGrow: 1 }} />
104125
<Stack
105126
direction="row"

0 commit comments

Comments
 (0)