Ensure only the copyable element itself is hover-able/click-able
This commit is contained in:
parent
459b4d06fe
commit
73922609e4
|
@ -148,7 +148,7 @@ const renderAccountRow = (account: Account) => {
|
|||
balance = `◎${(1.0 * account.lamports) / LAMPORTS_PER_SOL}`;
|
||||
}
|
||||
|
||||
const base58AccountPubkey = account.pubkey.toBase58()
|
||||
const base58AccountPubkey = account.pubkey.toBase58();
|
||||
return (
|
||||
<tr key={account.id}>
|
||||
<td>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useState, ReactNode } from "react";
|
||||
|
||||
type CopyableProps = {
|
||||
text: string
|
||||
children: ReactNode
|
||||
}
|
||||
text: string;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
const popover = (
|
||||
<div className="popover fade bs-popover-right show">
|
||||
|
@ -17,20 +17,17 @@ function Copyable({ text, children }: CopyableProps) {
|
|||
|
||||
const copyToClipboard = () => navigator.clipboard.writeText(text);
|
||||
const handleClick = () =>
|
||||
copyToClipboard()
|
||||
.then(() => {
|
||||
setShowPopover(true);
|
||||
setTimeout(setShowPopover.bind(null, false), 2500);
|
||||
});
|
||||
copyToClipboard().then(() => {
|
||||
setShowPopover(true);
|
||||
setTimeout(setShowPopover.bind(null, false), 2500);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="copyable">
|
||||
<div onClick={handleClick}>
|
||||
{children}
|
||||
</div>
|
||||
<div onClick={handleClick}>{children}</div>
|
||||
{showPopover && popover}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Copyable;
|
||||
export default Copyable;
|
||||
|
|
|
@ -13,7 +13,7 @@ code {
|
|||
.copyable {
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
& > div:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue