diff --git a/components/ErrorSection/index.scss b/components/ErrorSection/index.scss new file mode 100644 index 00000000..587d9ff9 --- /dev/null +++ b/components/ErrorSection/index.scss @@ -0,0 +1,22 @@ +section.Error { + align-items: center; + display: flex; + flex-direction: column; + gap: $unit; + margin: 0 auto; + max-width: 50vw; + justify-content: center; + height: 60vh; + text-align: center; + + .Code { + color: var(--text-secondary); + font-size: $font-tiny; + font-weight: $bold; + } + + .Button { + margin-top: $unit-2x; + width: fit-content; + } +} diff --git a/components/ErrorSection/index.tsx b/components/ErrorSection/index.tsx new file mode 100644 index 00000000..f0b904c6 --- /dev/null +++ b/components/ErrorSection/index.tsx @@ -0,0 +1,48 @@ +import React, { useEffect, useState } from 'react' +import Link from 'next/link' +import { useTranslation } from 'next-i18next' + +import Button from '~components/Button' +import { ResponseStatus } from '~types' + +import './index.scss' + +interface Props { + status: ResponseStatus +} + +const ErrorSection = ({ status }: Props) => { + // Import translations + const { t } = useTranslation('common') + + const [statusText, setStatusText] = useState('') + + useEffect(() => { + setStatusText(status.text.replace(' ', '_').toLowerCase()) + }, [status.text]) + + const errorBody = () => { + return ( + <> +
{t(`errors.${statusText}.description`)}
+ > + ) + } + + return ( +