UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 1.59 kB
"use strict";var o=require("react/jsx-runtime"),e=require("react"),r=require("styled-components"),t=require("./copy-BiZ7dtqy.js");const i=({style:e,color:r,...t})=>/*#__PURE__*/o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:r||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:/*#__PURE__*/o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});let n=/*#__PURE__*/r.styled.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(o=>o.$justCopied?"var(--privy-color-foreground)":o.color||"var(--privy-color-foreground-3)"),(o=>o.$justCopied?"medium":"normal"),(o=>o.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));exports.CopytoClipboardButton=r=>{let[s,p]=e.useState(!1);/*#__PURE__*/return o.jsxs(n,{color:r.color,onClick:()=>{p(!0),navigator.clipboard.writeText(r.text),setTimeout((()=>p(!1)),1500)},$justCopied:s,children:[s?/*#__PURE__*/o.jsx(i,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/o.jsx(t.Copy,{style:{height:"14px",width:"14px"}}),s?"Copied":"Copy"," ",r.itemName?r.itemName:"to Clipboard"]})};