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

65 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-08-14 21:05:22 +02:00
import { Trans } from "@lingui/macro"
import { Box, Button, Container, Group, type MantineTheme, Text, Title, useMantineTheme } from "@mantine/core"
2022-08-14 21:05:22 +02:00
import { TbRefresh } from "react-icons/tb"
import { tss } from "tss"
import { PageTitle } from "./PageTitle"
2022-08-14 21:05:22 +02:00
const useStyles = tss
.withParams<{
theme: MantineTheme
}>()
.create(({ theme }) => ({
root: {
paddingTop: 80,
},
2022-08-14 21:05:22 +02:00
label: {
textAlign: "center",
fontWeight: "bold",
fontSize: 120,
lineHeight: 1,
marginBottom: `calc(${theme.spacing.xl} * 1.5)`,
color: theme.colors[theme.primaryColor][3],
},
2022-08-14 21:05:22 +02:00
title: {
textAlign: "center",
fontWeight: "bold",
fontSize: 32,
},
2022-08-14 21:05:22 +02:00
description: {
maxWidth: 540,
margin: "auto",
marginTop: theme.spacing.xl,
marginBottom: `calc(${theme.spacing.xl} * 1.5)`,
},
}))
2022-08-14 21:05:22 +02:00
export function ErrorPage(props: { error: Error }) {
const theme = useMantineTheme()
const { classes } = useStyles({ theme })
2022-08-14 21:05:22 +02:00
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>
2023-12-29 23:09:30 +01:00
<Text size="lg" ta="center" className={classes.description}>
2022-08-14 21:05:22 +02:00
{props.error.message}
</Text>
2023-12-29 23:09:30 +01:00
<Group justify="center">
<Button size="md" onClick={() => window.location.reload()} leftSection={<TbRefresh size={18} />}>
2022-08-14 21:05:22 +02:00
Refresh the page
</Button>
</Group>
</Container>
</div>
)
}