mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-28 07:04:20 +00:00
* 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
39 lines
919 B
TypeScript
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>
|
|
)
|
|
}
|