Files
commafeed/commafeed-client/src/pages/ErrorPage.tsx

59 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-08-14 21:05:22 +02:00
import { Trans } from "@lingui/macro"
import { Box, Button, Container, createStyles, Group, Text, Title } from "@mantine/core"
2022-08-14 21:05:22 +02:00
import { TbRefresh } from "react-icons/tb"
import { PageTitle } from "./PageTitle"
2022-08-14 21:05:22 +02:00
const useStyles = createStyles(theme => ({
root: {
paddingTop: 80,
},
label: {
textAlign: "center",
fontWeight: "bold",
fontSize: 120,
lineHeight: 1,
2023-05-08 14:54:16 +02:00
marginBottom: `calc(${theme.spacing.xl} * 1.5)`,
2022-08-14 21:05:22 +02:00
color: theme.colors[theme.primaryColor][3],
},
title: {
textAlign: "center",
fontWeight: "bold",
fontSize: 32,
},
description: {
maxWidth: 540,
margin: "auto",
marginTop: theme.spacing.xl,
2023-05-08 14:54:16 +02:00
marginBottom: `calc(${theme.spacing.xl} * 1.5)`,
2022-08-14 21:05:22 +02:00
},
}))
export function ErrorPage(props: { error: Error }) {
const { classes } = useStyles()
return (
<div className={classes.root}>
<Container>
<PageTitle />
2022-08-14 21:05:22 +02:00
<Box className={classes.label}>
<Trans>Oops!</Trans>
</Box>
<Title className={classes.title}>
<Trans>Something bad just happened...</Trans>
</Title>
<Text size="lg" align="center" className={classes.description}>
{props.error.message}
</Text>
<Group position="center">
<Button size="md" onClick={() => window.location.reload()} leftIcon={<TbRefresh size={18} />}>
Refresh the page
</Button>
</Group>
</Container>
</div>
)
}