From 73922609e45ddd7906f11771d3fb277ba2572b0c Mon Sep 17 00:00:00 2001 From: Nick Brown Date: Fri, 17 Apr 2020 23:15:02 -0700 Subject: [PATCH] Ensure only the copyable element itself is hover-able/click-able --- explorer/src/components/AccountsCard.tsx | 2 +- explorer/src/components/Copyable.tsx | 21 +++++++++------------ explorer/src/scss/_solana.scss | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/explorer/src/components/AccountsCard.tsx b/explorer/src/components/AccountsCard.tsx index f6641ff3c4..d233e42ce7 100644 --- a/explorer/src/components/AccountsCard.tsx +++ b/explorer/src/components/AccountsCard.tsx @@ -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 ( diff --git a/explorer/src/components/Copyable.tsx b/explorer/src/components/Copyable.tsx index 27a91ae166..5c1d790e0c 100644 --- a/explorer/src/components/Copyable.tsx +++ b/explorer/src/components/Copyable.tsx @@ -1,9 +1,9 @@ import React, { useState, ReactNode } from "react"; type CopyableProps = { - text: string - children: ReactNode -} + text: string; + children: ReactNode; +}; const popover = (
@@ -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 (
-
- {children} -
+
{children}
{showPopover && popover}
); } -export default Copyable; \ No newline at end of file +export default Copyable; diff --git a/explorer/src/scss/_solana.scss b/explorer/src/scss/_solana.scss index 5ef707019d..033a136fa0 100644 --- a/explorer/src/scss/_solana.scss +++ b/explorer/src/scss/_solana.scss @@ -13,7 +13,7 @@ code { .copyable { position: relative; - &:hover { + & > div:hover { cursor: pointer; }