UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

18 lines (16 loc) 1.68 kB
"use strict";var e=require("react/jsx-runtime"),r=require("lucide-react"),s=require("react"),t=require("styled-components"),o=require("./use-export-wallet-_EIyxyle.js"),i=require("./ModalHeader-C5Wuo3-1.js");let n=t.styled.span` display: inline-flex; align-items: center; gap: 0.5rem; `,l=t.styled.span` font-size: 14px; font-weight: 500; color: var(--privy-color-foreground); `,a=t.styled.a` font-size: 14px; color: var(--privy-color-foreground); text-decoration: none; &:hover { text-decoration: underline; } `;exports.Address=({address:t,showCopyIcon:c,url:d,className:p})=>{let[x,u]=s.useState(!1);function m(e){e.stopPropagation(),navigator.clipboard.writeText(t).then((()=>u(!0))).catch(console.error)}return s.useEffect((()=>{if(x){let e=setTimeout((()=>u(!1)),3e3);return()=>clearTimeout(e)}}),[x]),d?/*#__PURE__*/e.jsxs(n,{children:[/*#__PURE__*/e.jsx(a,{title:t,className:p,href:`${d}/address/${t}`,target:"_blank",children:o.formatWalletAddress(t)}),c&&/*#__PURE__*/e.jsx(i.SecondaryButton,{onClick:m,size:"sm",style:{gap:"0.375rem"},children:x?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(r.Check,{size:16})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(r.Copy,{size:16})]})})]}):/*#__PURE__*/e.jsxs(n,{children:[/*#__PURE__*/e.jsx(l,{title:t,className:p,children:o.formatWalletAddress(t)}),c&&/*#__PURE__*/e.jsx(i.SecondaryButton,{onClick:m,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:x?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(r.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(r.Copy,{size:14})]})})]})};