1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/common/NotFound/NotFound.tsx
Tymoteusz Czech c8231d3efd
fix: 404 in dark theme (#4337)
## About the changes
Fix 404 error page UI in dark theme
2023-07-24 14:23:29 +00:00

80 lines
2.1 KiB
TypeScript

import { FC } from 'react';
import { Button, styled, Typography } from '@mui/material';
import { useNavigate } from 'react-router';
import { ReactComponent as LogoIcon } from 'assets/icons/logoBg.svg';
import { GO_BACK } from 'constants/navigate';
const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
minHeight: '100vh',
padding: theme.spacing(4),
position: 'fixed',
inset: 0,
backgroundColor: theme.palette.background.paper,
width: '100%',
}));
const StyledLogo = styled(LogoIcon)(({ theme }) => ({
height: '80px',
}));
const StyledContent = styled('div')(({ theme }) => ({
display: 'flex',
position: 'relative',
}));
const StyledButtonContainer = styled('div')(({ theme }) => ({
marginTop: theme.spacing(4),
}));
const StyledHomeButton = styled(Button)(({ theme }) => ({
height: '150px',
width: '150px',
position: 'absolute',
right: 100,
top: 45,
}));
const NotFound: FC = ({ children }) => {
const navigate = useNavigate();
const onClickHome = () => {
navigate('/');
};
const onClickBack = () => {
navigate(GO_BACK);
};
return (
<StyledContainer>
<div>
<StyledLogo />
<StyledContent>
<Typography variant="h1" style={{ fontSize: '2rem' }}>
Ooops. That's a page we haven't toggled on yet.
</Typography>
</StyledContent>
<StyledButtonContainer>
<Button
variant="contained"
color="primary"
onClick={onClickBack}
>
Go back
</Button>
<StyledHomeButton onClick={onClickHome}>
Go home
</StyledHomeButton>
</StyledButtonContainer>
</div>
{children}
</StyledContainer>
);
};
export default NotFound;