Files
upstream-shadcn-ui/apps/v4/components/open-in-v0-button.tsx
upstream-mirror 1416db152c
All checks were successful
Release / Create Version PR or Publish Stable Release (push) Has been skipped
Release / Publish Prerelease to NPM (push) Has been skipped
Monitor Registries / Monitor registry health (push) Has been skipped
snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:44:43 +05:00

32 lines
703 B
TypeScript

import { cn } from "cn"
import { Icons } from "@/components/icons"
import { Button } from "@/registry/new-york-v4/ui/button"
// v0 uses the default style.
const V0_STYLE = "new-york-v4"
export function OpenInV0Button({
name,
className,
...props
}: React.ComponentProps<typeof Button> & {
name: string
}) {
return (
<Button
size="sm"
asChild
className={cn("h-[1.8rem] gap-1", className)}
{...props}
>
<a
href={`${process.env.NEXT_PUBLIC_V0_URL}/chat/api/open?url=${process.env.NEXT_PUBLIC_APP_URL}/r/styles/${V0_STYLE}/${name}.json`}
target="_blank"
>
Open in <Icons.v0 className="size-5" />
</a>
</Button>
)
}