Skip to content
Snippets Groups Projects
Commit ba9b05a8 authored by Matt Kirby's avatar Matt Kirby
Browse files

Styled completion form

parent 01cd813b
No related branches found
No related tags found
1 merge request!24Fe questions and posts (This one is big)
import { Dialog, Transition } from "@headlessui/react"; import { Dialog, Transition } from '@headlessui/react';
import { FC, Fragment, PropsWithChildren, useEffect, useState } from "react"; import { CheckCircleIcon } from '@heroicons/react/24/outline';
import { FC, Fragment, PropsWithChildren, useEffect, useState } from 'react';
type DailyCompletionProps = { type DailyCompletionProps = {
show: boolean show: boolean;
} };
const DailyPostCompletion:FC<PropsWithChildren<DailyCompletionProps>> = ({ const DailyPostCompletion: FC<PropsWithChildren<DailyCompletionProps>> = ({ show }) => {
show
}) => {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [done, setDone] = useState(false) const [done, setDone] = useState(false);
useEffect(() => { useEffect(() => {
if(!isOpen && show && !done){ if (!isOpen && show && !done) {
setIsOpen(true) setIsOpen(true);
setDone(true) setDone(true);
setTimeout(() => { setTimeout(() => {
setIsOpen(false) setIsOpen(false);
}, 3000) }, 3000);
} }
}) });
return ( return (
<> <>
...@@ -52,17 +51,18 @@ const DailyPostCompletion:FC<PropsWithChildren<DailyCompletionProps>> = ({ ...@@ -52,17 +51,18 @@ const DailyPostCompletion:FC<PropsWithChildren<DailyCompletionProps>> = ({
<Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all"> <Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
<Dialog.Title <Dialog.Title
as="h3" as="h3"
className="text-lg font-medium leading-6 text-gray-900" className="text-lg font-medium leading-6 text-gray-900 text-center"
> >
Payment successful <div className="w-full flex justify-center mb-2">
<CheckCircleIcon className="h-12 w-12 rounded-full text-c-pink flex items-center justify-center" />
</div>
Your Daily has been posted!
</Dialog.Title> </Dialog.Title>
<div className="mt-2"> <div className="mt-2">
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500 text-center">
Your payment has been successfully submitted. We’ve sent Now have a look at what your friends have said :)
you an email with all of the details of your order.
</p> </p>
</div> </div>
</Dialog.Panel> </Dialog.Panel>
</Transition.Child> </Transition.Child>
</div> </div>
...@@ -70,7 +70,7 @@ const DailyPostCompletion:FC<PropsWithChildren<DailyCompletionProps>> = ({ ...@@ -70,7 +70,7 @@ const DailyPostCompletion:FC<PropsWithChildren<DailyCompletionProps>> = ({
</Dialog> </Dialog>
</Transition> </Transition>
</> </>
) );
} };
export default DailyPostCompletion; export default DailyPostCompletion;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment