fixed about link, back to top

This commit is contained in:
2023-01-08 21:17:59 +01:00
parent eb33c666ec
commit b01537fd7b
2 changed files with 3 additions and 18 deletions
+1 -4
View File
@@ -42,11 +42,8 @@ const BackToTop = (props) => {
sx={{ sx={{
position: 'fixed', position: 'fixed',
bottom: theme.spacing(2), bottom: theme.spacing(2),
right: theme.spacing(2), left: theme.spacing(1),
}} }}
container
justifyContent='center'
alignItems='center'
id='footer'> id='footer'>
<ScrollTop {...props}> <ScrollTop {...props}>
<KeyboardArrowUpIcon <KeyboardArrowUpIcon
@@ -18,17 +18,6 @@ import ThreeSixtyOutlinedIcon from '@mui/icons-material/ThreeSixtyOutlined';
import DarkModeToggle from 'layouts/common/darkModeToggle'; import DarkModeToggle from 'layouts/common/darkModeToggle';
import HideOnScroll from 'layouts/common/hideOnScroll'; import HideOnScroll from 'layouts/common/hideOnScroll';
const handleScrollDown = (event) => {
event.preventDefault();
const anchor = (event.target.ownerDocument || document).querySelector(
'#footer'
);
if (anchor) {
anchor.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
};
const Header = () => { const Header = () => {
const theme = useTheme(); const theme = useTheme();
@@ -61,9 +50,8 @@ const Header = () => {
<MaterialLink <MaterialLink
color='textPrimary' color='textPrimary'
to='#about' href='#about'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}>
onClick={handleScrollDown}>
About About
</MaterialLink> </MaterialLink>
</Breadcrumbs> </Breadcrumbs>