Skip to content

Commit

Permalink
fix copyToClipboardButton render bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dsoskey committed Apr 9, 2024
1 parent 3932138 commit ad9def8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ui/component/copyToClipboardButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export const CopyToClipboardButton = ({ buttonText, copyText, className, childre
const [clipboardStatus, setClipboardStatus] =
useState<TaskStatus>('unstarted')

let content = DEFAULT_BUTTON_TEXT[clipboardStatus];
if (children) {
content = children
} else if (buttonText) {
content = buttonText[clipboardStatus]
}

return <button
{...rest}
className={className}
Expand All @@ -35,6 +42,6 @@ export const CopyToClipboardButton = ({ buttonText, copyText, className, childre
})
}}
>
{children ?? buttonText[clipboardStatus] ?? DEFAULT_BUTTON_TEXT[clipboardStatus]}
{content}
</button>
}

0 comments on commit ad9def8

Please sign in to comment.