diff options
Diffstat (limited to '')
-rw-r--r-- | docusaurus/src/theme/Footer/InputPreloader.tsx | 46 | ||||
-rw-r--r-- | docusaurus/src/theme/Footer/index.tsx | 27 |
2 files changed, 30 insertions, 43 deletions
diff --git a/docusaurus/src/theme/Footer/InputPreloader.tsx b/docusaurus/src/theme/Footer/InputPreloader.tsx index 325f8a7..2ba2e19 100644 --- a/docusaurus/src/theme/Footer/InputPreloader.tsx +++ b/docusaurus/src/theme/Footer/InputPreloader.tsx @@ -1,35 +1,31 @@ -/** - * @license - * SPDX-License-Identifier: AGPL-3.0-or-later - * This file is part of Wolfree. - * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - */ - -import React, { useEffect, useState } from "react"; - -const InputPreloader = () => { - const [showIframe, setShowIframe] = useState(false); - - useEffect(() => { - const handleIframeLoad = () => { - // Show the iframe after a 3000ms delay - const timerId = setTimeout(() => setShowIframe(true), 3000); - // Cleanup the timer when the component unmounts - return () => clearTimeout(timerId); - }; +/* SPDX-License-Identifier: AGPL-3.0-or-later */ - window.scroll(0, 0); +import React from "react"; + +export default (): React.JSX.Element => { + const [insertIframe, setInsertIframe] = React.useState(false); + + React.useEffect((): (() => void) => { + const handleIframeLoad = (): (() => void) => { + // Insert the iframe after a 3000ms delay. + const timerId = setTimeout((): void => setInsertIframe(true), 3000); + + // Cleanup the timer when the component unmounts. + return (): void => clearTimeout(timerId); + }; window.addEventListener("load", handleIframeLoad); - // Cleanup the event listener when the component unmounts - return () => window.removeEventListener("load", handleIframeLoad); - }, []); // Empty dependency array means the effect runs only once after initial render + window.scroll(0, 0); + + // Cleanup the event listener when the component unmounts. + return (): void => window.removeEventListener("load", handleIframeLoad); + }, []); // Empty dependency array means the effect runs only once after initial render. return ( <> {/* Use a descriptive title for accessibility */} - {showIframe && ( + {insertIframe && ( <iframe title="Input Page Preloader" src="/input/" @@ -39,5 +35,3 @@ const InputPreloader = () => { </> ); }; - -export default InputPreloader; diff --git a/docusaurus/src/theme/Footer/index.tsx b/docusaurus/src/theme/Footer/index.tsx index 2edef40..e4063c5 100644 --- a/docusaurus/src/theme/Footer/index.tsx +++ b/docusaurus/src/theme/Footer/index.tsx @@ -1,21 +1,14 @@ -/** - * @license - * SPDX-License-Identifier: AGPL-3.0-or-later - * This file is part of Wolfree. - * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - */ +/* SPDX-License-Identifier: AGPL-3.0-or-later */ -import React from "react"; import Footer from "@theme-original/Footer"; import InputPreloader from "./InputPreloader"; +import React from "react"; -const FooterWrapper = (props: React.JSX.IntrinsicAttributes) => { - return ( - <> - <Footer {...props} /> - <InputPreloader /> - </> - ); -}; - -export default FooterWrapper; +export default ( + props: React.JSX.ElementAttributesProperty +): React.JSX.Element => ( + <> + <Footer {...props} /> + <InputPreloader /> + </> +); |