-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: resolve the following problems
* RadioGroup error using forwardRef when isn't necessary * Make Jotform iframe as component and adding a loading to prevent weird behavios while jotform load the form * fix jotform undefined variable * add package.lock file pending * new color for tailwind
- Loading branch information
1 parent
3f83ca8
commit 9ec6f72
Showing
14 changed files
with
279 additions
and
262 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
apps/eo_web/dist/assets/main-0d348634.css → apps/eo_web/dist/assets/main-41da5d34.css
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { useEffect, useRef, useState } from "react"; | ||
|
||
import { jotformScript } from "~/helpers/jotform_script"; | ||
// import { forwardRef } from "@eo/shared"; | ||
import { useMount } from "~/hooks/useMount"; | ||
|
||
interface JotformFrameProps { | ||
formId: string | number; | ||
searchParam?: URLSearchParams; | ||
} | ||
|
||
const Iframe = ({ formId, searchParam }: JotformFrameProps) => { | ||
const ref = useRef<HTMLIFrameElement>(null); | ||
useMount(() => { | ||
jotformScript(formId); | ||
setTimeout(() => { | ||
if (ref?.current?.hidden) ref.current.hidden = false; | ||
}, 1700); | ||
}, [formId, searchParam]); | ||
|
||
return ( | ||
<iframe | ||
ref={ref} | ||
src={`https://form.jotform.com/${formId}?${ | ||
searchParam ? searchParam.toString() : "" | ||
}`} | ||
id={`JotFormIFrame-${formId}`} | ||
title="" | ||
onLoad={() => { | ||
window.parent.scrollTo(0, 0); | ||
}} | ||
allow="geolocation; microphone; camera" | ||
allowFullScreen={true} | ||
className="h-full w-full" | ||
style={{ | ||
minWidth: "100%", | ||
height: "539px", | ||
border: "none", | ||
}} | ||
hidden | ||
></iframe> | ||
); | ||
}; | ||
|
||
const Loading = () => { | ||
const [showLoading, setShowLoading] = useState(true); | ||
useEffect(() => { | ||
setTimeout(() => { | ||
setShowLoading(false); | ||
}, 1200); | ||
}); | ||
|
||
return ( | ||
<> | ||
{showLoading && ( | ||
<div | ||
className="h-12 w-12 animate-spin rounded-full border-4 border-gray-200 border-t-gray-1000" | ||
style={{ | ||
position: "absolute", | ||
top: "50%", | ||
right: "calc(50% - 20px)", | ||
}} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export const JotformFrame = ({ formId, searchParam }: JotformFrameProps) => { | ||
return ( | ||
<> | ||
<Loading /> | ||
<Iframe formId={formId} searchParam={searchParam} /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.