diff --git a/documentation/src/refine-theme/landing-try-it-section.tsx b/documentation/src/refine-theme/landing-try-it-section.tsx index a3cfba91..a09b00b7 100644 --- a/documentation/src/refine-theme/landing-try-it-section.tsx +++ b/documentation/src/refine-theme/landing-try-it-section.tsx @@ -2,58 +2,9 @@ import React from "react"; import clsx from "clsx"; import { LandingStartActionIcon } from "./icons/landing-start-action"; import { LandingCopyCommandButton } from "./landing-copy-command-button"; -import { LandingPlaygroundModal } from "./landing-playground-modal"; -import { useLocation } from "@docusaurus/router"; -import { useColorMode } from "@docusaurus/theme-common"; -import { useInView } from "framer-motion"; import Link from "@docusaurus/Link"; export const LandingTryItSection = ({ className }: { className?: string }) => { - const [wizardOpen, setWizardOpen] = React.useState(false); - - const onClick = React.useCallback(() => { - setWizardOpen(true); - }, []); - - const { search, hash } = useLocation(); - - const [params, setParams] = React.useState>({}); - - React.useEffect(() => { - const _params = new URLSearchParams(search); - const paramsObj: Record = {}; - - // @ts-expect-error no downlevel iteration - for (const [key, value] of _params.entries()) { - paramsObj[key] = value; - } - - setParams(paramsObj); - }, [search]); - - const scrollToItem = React.useCallback(() => { - const playgroundElement = document.getElementById("playground"); - if (playgroundElement) { - playgroundElement.scrollIntoView({ - behavior: "smooth", - block: "start", - inline: "nearest", - }); - } - }, []); - - React.useEffect(() => { - if (params.playground || hash === "#playground") { - scrollToItem(); - } - }, [params.playground, hash]); - - React.useEffect(() => { - if (wizardOpen) { - scrollToItem(); - } - }, [wizardOpen]); - return (
); }; - -const LandingTryItWizardSection = ({ - className, - visible, -}: { - className?: string; - visible: boolean; -}) => { - const ref = React.useRef(null); - const inView = useInView(ref, { - margin: "100px", - }); - - const iframeRef = React.useRef(null); - const { colorMode } = useColorMode(); - - React.useEffect(() => { - // when color mode changes, post a message to the iframe - // to update its color mode - if (iframeRef.current) { - iframeRef.current.contentWindow?.postMessage( - { - type: "colorMode", - colorMode, - }, - "*", - ); - } - }, [colorMode, visible]); - - return ( -
-
-
- {inView ? ( -