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 i,Copy as t}from"lucide-react";import{useState as n,useEffect as l}from"react";import{styled as s}from"styled-components";import{D as a}from"./useActiveWallet-3RHPIBxJ.mjs";import{S as c}from"./ModalHeader-D8-mhjp4.mjs";const d=({address:s,showCopyIcon:d,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(m,h?{children:[/*#__PURE__*/r(f,{title:s,className:u,href:`${h}/address/${s}`,target:"_blank",children:a(s)}),d&&/*#__PURE__*/r(c,{onClick:y,size:"sm",style:{gap:"0.375rem"},children:/*#__PURE__*/e(o,g?{children:["Copied",/*#__PURE__*/r(i,{size:16})]}:{children:["Copy",/*#__PURE__*/r(t,{size:16})]})})]}:{children:[/*#__PURE__*/r(p,{title:s,className:u,children:a(s)}),d&&/*#__PURE__*/r(c,{onClick:y,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:/*#__PURE__*/e(o,g?{children:["Copied",/*#__PURE__*/r(i,{size:14})]}:{children:["Copy",/*#__PURE__*/r(t,{size:14})]})})]})};let m=s.span` display: inline-flex; align-items: center; gap: 0.5rem; `,p=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{d as A};