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