@privy-io/react-auth
Version:
React client for the Privy Auth API
30 lines (29 loc) • 1.79 kB
JavaScript
;var e=require("react/jsx-runtime"),r=require("lucide-react"),s=require("react"),t=require("styled-components"),i=require("./ModalHeader-C5Wuo3-1.js"),o=require("./ErrorMessage-BfTVyue9.js"),d=require("./LabelXs-C8rLnCfU.js"),l=require("./Address-BeuDoSGB.js"),n=require("./shared-DBm7PUrg.js");let a=t.styled(n.Box)`
&& {
padding: 0.75rem;
height: 56px;
}
`,c=t.styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
`,u=t.styled.div`
display: flex;
flex-direction: column;
gap: 0;
`,x=t.styled.div`
font-size: 12px;
line-height: 1rem;
color: var(--privy-color-foreground-3);
`,h=t.styled(d.LabelXs)`
text-align: left;
margin-bottom: 0.5rem;
`,j=t.styled(o.ErrorMessage)`
margin-top: 0.25rem;
`,p=t.styled(i.SecondaryButton)`
&& {
gap: 0.375rem;
font-size: 14px;
}
`;exports.WalletInfoCard=({errMsg:t,balance:i,address:o,className:d,title:n,showCopyButton:m=!1})=>{let[y,g]=s.useState(!1);return s.useEffect((()=>{if(y){let e=setTimeout((()=>g(!1)),3e3);return()=>clearTimeout(e)}}),[y]),/*#__PURE__*/e.jsxs("div",{children:[n&&/*#__PURE__*/e.jsx(h,{children:n}),/*#__PURE__*/e.jsx(a,{className:d,$state:t?"error":void 0,children:/*#__PURE__*/e.jsxs(c,{children:[/*#__PURE__*/e.jsxs(u,{children:[/*#__PURE__*/e.jsx(l.Address,{address:o,showCopyIcon:!1}),void 0!==i&&/*#__PURE__*/e.jsx(x,{children:i})]}),m&&/*#__PURE__*/e.jsx(p,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(o).then((()=>g(!0))).catch(console.error)},size:"sm",children:y?/*#__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})]})})]})}),t&&/*#__PURE__*/e.jsx(j,{children:t})]})};