32 lines
812 B
TypeScript
32 lines
812 B
TypeScript
import Toolbar from '@mui/material/Toolbar';
|
|
import Typography from '@mui/material/Typography';
|
|
|
|
import type { ToolbarProps } from '@mui/material/Toolbar/Toolbar';
|
|
import type { FC } from 'react';
|
|
|
|
export type ErrorPageToolbarProps = ToolbarProps & {
|
|
type?: '404' | 'ErrorBoundary';
|
|
};
|
|
|
|
const TITLE: Record<NonNullable<ErrorPageToolbarProps['type']>, string> = {
|
|
404: 'Страницы не существует',
|
|
ErrorBoundary: 'Непредвиденная ошибка',
|
|
};
|
|
|
|
const ErrorPageToolbar: FC<ErrorPageToolbarProps> = (props) => {
|
|
const {
|
|
type = 'ErrorBoundary',
|
|
...restProps
|
|
} = props;
|
|
|
|
return (
|
|
<Toolbar {...restProps}>
|
|
<Typography noWrap component="div" variant="h6">
|
|
{TITLE[type]}
|
|
</Typography>
|
|
</Toolbar>
|
|
);
|
|
};
|
|
|
|
export default ErrorPageToolbar;
|