mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
22 lines
519 B
TypeScript
22 lines
519 B
TypeScript
import { useTranslations } from "next-intl";
|
|
|
|
type ErrorMessageProps = {
|
|
errorMessage: string;
|
|
};
|
|
|
|
export const ErrorMessage = ({ errorMessage }: ErrorMessageProps) => {
|
|
const t = useTranslations();
|
|
|
|
type TranslationKey = Parameters<typeof t>[0];
|
|
|
|
return errorMessage !== undefined ? (
|
|
<div className="mt-2 font-medium text-orange-700">
|
|
<p>
|
|
{errorMessage.startsWith("FormValidation")
|
|
? t(errorMessage as TranslationKey)
|
|
: errorMessage}
|
|
</p>
|
|
</div>
|
|
) : null;
|
|
};
|