'use client';
import { FormContext } from './context/form-context';
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid';
import { Background, LoadingSpinner } from '@repo/ui';
import type { PropsWithChildren } from 'react';
import { useContext } from 'react';
function OverlayWrapper({ children }: PropsWithChildren) {
return (
{children}
);
}
export function Overlay() {
const { formState } = useContext(FormContext);
const { status, text } = formState;
if (status === 'pending')
return (
{LoadingSpinner} Загрузка...
);
if (status === 'success')
return (
{' '}
Данные сохранены
);
if (status === 'error') {
return (
{' '}
{text}
);
}
return false;
}