Skip to content

Commit

Permalink
fix: show input button when label is not defined #2025
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok authored and mturoci committed Sep 6, 2023
1 parent f5f656d commit ad785cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/src/copyable_text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface CopyableText {
height?: S
}

type CopyButton = {
type ClipboardCopyButton = {
/** Text to be copied to clipboard. */
value: S,
/** The element to which the copy button is attached. */
Expand All @@ -75,7 +75,7 @@ type CopyButton = {
portal?: B
}

export const ClipboardCopyButton = ({ value, anchorElement, showOnHoverOnly = false, portal = false }: CopyButton) => {
export const ClipboardCopyButton = ({ value, anchorElement, showOnHoverOnly = false, portal = false }: ClipboardCopyButton) => {
const
timeoutRef = React.useRef<U>(),
[copied, setCopied] = React.useState(false),
Expand Down Expand Up @@ -125,9 +125,9 @@ export const XCopyableText = ({ model }: { model: CopyableText }) => {
heightStyle = multiline && height === '1' ? fullHeightStyle : undefined,
[inputEl, setInputEl] = React.useState(),
domRef = React.useCallback(node => {
const inputEl = node?.children[0]?.children[1]
const inputEl = node?.children[0]?.children[label ? 1 : 0]
if (inputEl) setInputEl(inputEl)
}, [])
}, [label])

return (
<>
Expand Down

0 comments on commit ad785cd

Please sign in to comment.