import React, { useEffect } from 'react'
import PropTypes from 'prop-types'
import ReactJson from 'react-json-view'

export function SubmitFormResult(props) {
    const { setPopupTitle, data } = props

    useEffect(() => {
        if (setPopupTitle) { setPopupTitle('Data submitted from the form') }
    })

    return (
        <>
            <div className="overflow-y-auto max-h-screen-75 p-3 text-xl">
                <ReactJson name="formData" src={data} enableClipboard={false} />
            </div>
        </>
    )
}

SubmitFormResult.propTypes = {
    setPopupTitle: PropTypes.func,
    data: PropTypes.object,
}

export default SubmitFormResult

