'use client'; import { FormContext } from './context/form-context'; import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'; import { Background, Button, LoadingSpinner } from '@repo/ui'; import type { PropsWithChildren } from 'react'; import { useContext } from 'react'; function OverlayWrapper({ children }: PropsWithChildren) { return (
{children}
); } function StateContentWrapper({ children }: PropsWithChildren) { return
{children}
; } export function Overlay() { const { formState, setFormState } = useContext(FormContext); const { status, text } = formState; let stateContent: JSX.Element | false = false; if (status === 'pending') { stateContent = ( {LoadingSpinner}

Загрузка...

); } if (status === 'success') { stateContent = (

Данные сохранены

); } if (status === 'error') { stateContent = ( <>

{text}

{' '} ); } if (!stateContent) return false; return {stateContent}; }