Files
shadcn-ui/apps/www/components/project-add-button.tsx
shadcn 05145e66d3 feat: refactor registry (#6071)
* feat(www): add login blocks

* chore(www): restructure for blocks

* chore: build registry

* chore: clean up chunks

* fix(www): chart categories

* feat(www): big registry refactor

* feat(www): update blocks

* feat: complex blocks

* fix: update schema

* feat: sync new-york and default

* fix: lint

* feat: move charts

* fix(www): code

* fix: src path

* chore: rebuild registry

* fix: screenshot

* fix: set new-york as default
2024-12-14 14:52:55 +04:00

39 lines
919 B
TypeScript

"use client"
import { Check, PlusCircle } from "lucide-react"
import { cn } from "@/lib/utils"
import { useProject } from "@/hooks/use-project"
import { Button } from "@/registry/new-york/ui/button"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/registry/new-york/ui/tooltip"
export function ProjectAddButton({
name,
className,
...props
}: React.ComponentProps<typeof Button> & { name: string }) {
const { addBlock, isAdded } = useProject()
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="sm"
className={cn("rounded-sm", className)}
onClick={() => {
addBlock(name)
}}
{...props}
>
{isAdded ? <Check /> : <PlusCircle />}
</Button>
</TooltipTrigger>
<TooltipContent sideOffset={10}>Add to Project</TooltipContent>
</Tooltip>
)
}