import clsx from "clsx"; import React from "react"; import { useLocation } from "@docusaurus/router"; import { PlayOutlinedIcon } from "./icons/play-outlined"; import { LandingPlaygroundModal } from "./landing-playground-modal"; import { LandingRainbowButton } from "./landing-rainbow-button"; export const LandingPlayground = () => { const { search, hash } = useLocation(); const [playgroundVisible, setPlaygroundVisible] = React.useState(false); 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 (playgroundVisible) { scrollToItem(); } }, [playgroundVisible]); return ( <>
Develop with your {" "} favorite tech stack