"use client" import { Toggle } from "docs-ui" import clsx from "clsx" import { usePathname } from "next/navigation" import { useVersion } from "../../providers/version" const VersionSwitcher = () => { const pathname = usePathname() const { version } = useVersion() return (
V1 { let newPath = pathname.replace("/v2", "") if (checked) { newPath += `/v2` } location.href = location.href.replace(pathname, newPath) }} /> V2
) } export default VersionSwitcher