Files
medusa-store/www/apps/api-reference/components/VersionSwitcher/index.tsx
Shahed Nasser 22f30f54fd docs: update api-reference project for v2 (#7307)
* remove everything v1 and make v2 default

* move main v2 rewrites to book

* move rewrites to book + other fixes
2024-05-16 09:02:35 +02:00

25 lines
599 B
TypeScript

"use client"
import { Toggle } from "docs-ui"
import clsx from "clsx"
import { usePathname } from "next/navigation"
const VersionSwitcher = () => {
const pathname = usePathname()
return (
<div className="flex gap-0.5 justify-center items-center">
<span className={clsx("text-medusa-fg-disabled")}>V1</span>
<Toggle
checked={true}
onCheckedChange={() => {
location.href = process.env.NEXT_PUBLIC_API_V1_URL + pathname
}}
/>
<span className={clsx("text-medusa-fg-subtle")}>V2</span>
</div>
)
}
export default VersionSwitcher