UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

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