Skip to content

Commit

Permalink
Address feedback and fix stylings
Browse files Browse the repository at this point in the history
  • Loading branch information
raducristianpopa committed Feb 13, 2024
1 parent ed57e31 commit 4c297ad
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Code = ({ value, className, ...props }: CodeProps) => {
return (
<div
className={cn(
'flex items-center gap-x-2 rounded-xl bg-nav-active p-4 text-medium break-all',
'flex items-center justify-between gap-x-2 rounded-xl bg-nav-active p-4 text-medium break-all',
className,
)}
{...props}>
Expand All @@ -31,9 +31,11 @@ const CopyButton = ({ value, ...props }: CopyButtonProps) => {
const [hasCopied, setHasCopied] = React.useState(false)

React.useEffect(() => {
setTimeout(() => {
setHasCopied(false)
}, 2000)
if (hasCopied === true) {
setTimeout(() => {
setHasCopied(false)
}, 2000)
}
}, [hasCopied])

return (
Expand All @@ -42,7 +44,7 @@ const CopyButton = ({ value, ...props }: CopyButtonProps) => {
aria-label="copy"
variant="ghost"
size="icon"
className="text-primary"
className="text-primary rounded-sm"
onClick={() => {
navigator.clipboard.writeText(value)
setHasCopied(true)
Expand Down

0 comments on commit 4c297ad

Please sign in to comment.