Raw
1 "use client"
2
3 import { Toggle } from "docs-ui"
4 import clsx from "clsx"
5 import { usePathname } from "next/navigation"
6
7 const VersionSwitcher = () => {
8 const pathname = usePathname()
9
10 return (
11 <div className="flex gap-0.5 justify-center items-center">
12 <span className={clsx("text-medusa-fg-disabled")}>V1</span>
13 <Toggle
14 checked={true}
15 onCheckedChange={() => {
16 location.href = process.env.NEXT_PUBLIC_API_V1_URL + pathname
17 }}
18 />
19 <span className={clsx("text-medusa-fg-base")}>V2</span>
20 </div>
21 )
22 }
23
24 export default VersionSwitcher