/* eslint-disable no-undef */ export const Form = ({ onSuccess }) => { const container = document.createElement('div'); const getInnerHTML = ({ complete }) => `
${complete ? '

Completed!!

' : ''}
`; container.innerHTML = getInnerHTML({ complete: false }); const form = container.querySelector('form'); form.addEventListener('submit', (e) => { e.preventDefault(); setTimeout(() => { container.innerHTML = getInnerHTML({ complete: true }); }, 500); setTimeout(() => { container.innerHTML = getInnerHTML({ complete: false }); }, 1500); onSuccess(e); }); return container; };