Skip to content

Commit

Permalink
Hide form popup on submission
Browse files Browse the repository at this point in the history
Make the form popup disappear upon successful submission and display the thank you message in the center of the page for an extended duration.
[skip gpt_engineer]
  • Loading branch information
lovable-dev[bot] committed Dec 29, 2024
1 parent b1b447e commit 5fd725d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/landing/WaitlistForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const WaitlistForm = () => {

console.log('Form submitted successfully')
toast({
duration: 3000,
className: "bg-white dark:bg-gray-800",
className: "fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-gray-800 p-6 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 w-96",
description: (
<div className="flex flex-col items-center gap-2">
<div className="flex items-center gap-2">
Expand All @@ -68,6 +67,14 @@ export const WaitlistForm = () => {
)
})
reset()
// Find and close the dialog
const dialog = document.querySelector('[role="dialog"]')
if (dialog) {
const closeButton = dialog.querySelector('button[aria-label="Close"]')
if (closeButton) {
closeButton.click()
}
}
} catch (error) {
console.error('Error submitting form:', error)
toast({
Expand Down

0 comments on commit 5fd725d

Please sign in to comment.