Files
supabase/apps/ui-library/components/command.tsx
T
Ivan Vasilov 0990155ae7 feat: more fixes for UI library (#34355)
* Regenerate the registry files.

* Regenerate the llms.txt file.

* Set the supabase project for testing.

* Fix the registryBlock component.

* Various fixes.

* Add missing deps to satisfy TS build.

* Fix the tanstack client.

* Add a tanstack block for password-based auth.

* Fix the command URL.

* Fix the env vars in the React client.

* Add missing pages to the nextjs auth.

* Simplify the tanstack auth block.

* Add success state to the forgot-password form.

* Fix the v0 button. Add some more docs.

* Revert some changes.
2025-03-24 14:24:59 +01:00

28 lines
854 B
TypeScript

import { CommandCopyButton } from './command-copy-button'
interface CommandCopyProps {
name: string
}
export function Command({ name }: CommandCopyProps) {
const command = `npx shadcn@latest add ${
process.env.VERCEL_TARGET_ENV === 'production'
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
: process.env.VERCEL_TARGET_ENV === 'preview'
? `https://${process.env.VERCEL_PROJECT_PREVIEW_URL}`
: 'http://localhost:3004'
}${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}/r/${name}.json`
return (
<>
<div className="relative flex items-center rounded-lg bg-black px-4 py-3">
<div className="flex-1 font-mono text-sm text-white">
<span className="mr-2 text-[#888]">$</span>
{command}
</div>
<CommandCopyButton command={command} />
</div>
</>
)
}