import classNames from 'classnames' import useTranslation from 'next-translate/useTranslation' import { FetchState as FormStateType } from '../../../hooks/useFetchState' import { Loader } from '../Loader' export interface FormStateProps { state: FormStateType message?: string | null id?: string } export const FormState: React.FC = (props) => { const { state, message, id } = props const { t } = useTranslation() if (state === 'loading') { return (
) } if (state === 'idle' || message == null) { return null } return ( <>
{t(`errors:${state}`)}: {message}
) }