chart-copy-button.tsx — ui Source File
Architecture documentation for chart-copy-button.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b9586a80_14bb_7728_5f2e_6a87ad27485c["chart-copy-button.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 39a0d62e_8e7d_d097_eb95_91d2bca361f7["icons-react"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> 39a0d62e_8e7d_d097_eb95_91d2bca361f7 a9903b11_2f1d_8437_2ec7_acd8ba077fa8["events"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> a9903b11_2f1d_8437_2ec7_acd8ba077fa8 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 57e86e45_ac6e_7278_be08_9092724e8401["button"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> 57e86e45_ac6e_7278_be08_9092724e8401 a2518e24_160d_3f8f_bb12_2206d8e84ab8["tooltip"] b9586a80_14bb_7728_5f2e_6a87ad27485c --> a2518e24_160d_3f8f_bb12_2206d8e84ab8 style b9586a80_14bb_7728_5f2e_6a87ad27485c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { IconCheck, IconCopy } from "@tabler/icons-react"
import { trackEvent, type Event } from "@/lib/events"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/registry/new-york-v4/ui/tooltip"
export function ChartCopyButton({
event,
name,
code,
className,
...props
}: {
event: Event["name"]
name: string
code: string
} & React.ComponentProps<typeof Button>) {
const [hasCopied, setHasCopied] = React.useState(false)
React.useEffect(() => {
setTimeout(() => {
setHasCopied(false)
}, 2000)
}, [hasCopied])
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className={cn(
"[&_svg]-h-3.5 h-7 w-7 rounded-[6px] [&_svg]:w-3.5",
className
)}
onClick={() => {
navigator.clipboard.writeText(code)
trackEvent({
name: event,
properties: {
name,
},
})
setHasCopied(true)
}}
{...props}
>
<span className="sr-only">Copy</span>
{hasCopied ? <IconCheck /> : <IconCopy />}
</Button>
</TooltipTrigger>
<TooltipContent className="bg-black text-white">Copy code</TooltipContent>
</Tooltip>
)
}
Domain
Subdomains
Functions
Dependencies
- button
- events
- icons-react
- react
- tooltip
- utils
Source
Frequently Asked Questions
What does chart-copy-button.tsx do?
chart-copy-button.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, Dictionary subdomain.
What functions are defined in chart-copy-button.tsx?
chart-copy-button.tsx defines 1 function(s): ChartCopyButton.
What does chart-copy-button.tsx depend on?
chart-copy-button.tsx imports 6 module(s): button, events, icons-react, react, tooltip, utils.
Where is chart-copy-button.tsx in the architecture?
chart-copy-button.tsx is located at apps/v4/components/chart-copy-button.tsx (domain: Internationalization, subdomain: Dictionary, directory: apps/v4/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free