UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

47 lines (46 loc) 1.3 kB
"use client"; import { jsxs as a, jsx as o } from "react/jsx-runtime"; import { cn as t } from "../../lib/utils.js"; import { useCopyToClipboard as n } from "../../hooks/use-copy-to-clipboard.js"; import { Button as c } from "./button.js"; import l from "../../node_modules/lucide-react/dist/esm/icons/check.js"; import m from "../../node_modules/lucide-react/dist/esm/icons/copy.js"; function y({ content: s, copyMessage: i }) { const { isCopied: e, handleCopy: r } = n({ text: s, copyMessage: i }); return /* @__PURE__ */ a( c, { variant: "ghost", size: "icon", className: "relative h-6 w-6", "aria-label": "Copy to clipboard", onClick: r, children: [ /* @__PURE__ */ o("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ o( l, { className: t( "h-4 w-4 transition-transform ease-in-out", e ? "scale-100" : "scale-0" ) } ) }), /* @__PURE__ */ o( m, { className: t( "h-4 w-4 transition-transform ease-in-out", e ? "scale-0" : "scale-100" ) } ) ] } ); } export { y as CopyButton };