File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 23502350 font-size : 0.6875rem ;
23512351 color : var (--color-cyan );
23522352 word-break : break-all;
2353+ background : none;
2354+ border : none;
2355+ padding : 0 ;
2356+ cursor : pointer;
2357+ text-align : left;
2358+ transition : opacity 0.15s ease;
2359+ }
2360+
2361+ .nl-donate-addr : hover {
2362+ opacity : 0.7 ;
23532363 }
23542364
23552365 .nl-table-wrap {
Original file line number Diff line number Diff line change 11'use client' ;
22
3+ import { useState } from 'react' ;
34import { QRCodeSVG } from 'qrcode.react' ;
45
56interface DonateFooterProps {
67 address : string ;
78}
89
910export function DonateFooter ( { address } : DonateFooterProps ) {
11+ const [ copied , setCopied ] = useState ( false ) ;
1012 const truncated = `${ address . slice ( 0 , 16 ) } …${ address . slice ( - 16 ) } ` ;
1113
14+ function handleCopy ( ) {
15+ navigator . clipboard . writeText ( address ) ;
16+ setCopied ( true ) ;
17+ setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
18+ }
19+
1220 return (
1321 < div className = "nl-donate" >
1422 < QRCodeSVG
@@ -20,7 +28,9 @@ export function DonateFooter({ address }: DonateFooterProps) {
2028 />
2129 < div className = "nl-donate-text" >
2230 < span className = "nl-donate-label" > Support CipherScan</ span >
23- < code className = "nl-donate-addr" title = { address } > { truncated } </ code >
31+ < button className = "nl-donate-addr" onClick = { handleCopy } title = "Click to copy" >
32+ { copied ? 'Copied ✓' : truncated }
33+ </ button >
2434 </ div >
2535 </ div >
2636 ) ;
You can’t perform that action at this time.
0 commit comments