Skip to content

Commit a278e3f

Browse files
committed
chore: add showOnTruncate extra prop to Tippy
1 parent 82c9189 commit a278e3f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const AddButton = ({
3232
return (
3333
<div className="flexbox flex-justify-start">
3434
<Tippy
35+
showOnTruncate
3536
className="default-tt dc__word-break"
3637
arrow={false}
3738
placement="right"

src/Common/Tippy.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { useCallback, useState, Children, cloneElement } from 'react'
2-
import TippyJS, { TippyProps as TippyJSProps } from '@tippyjs/react'
2+
import TippyJS from '@tippyjs/react'
3+
import { TippyProps } from './Types'
34

4-
const Tippy = ({ children, ...rest }: TippyJSProps) => {
5+
const Tippy = ({ showOnTruncate = false, children, ...rest }: TippyProps) => {
56
const [showTippy, setShowTippy] = useState(false)
67

78
const refCallback = useCallback((node: HTMLDivElement) => {
8-
if (node) {
9+
if (node && showOnTruncate) {
910
setShowTippy(node.scrollWidth > node.clientWidth)
1011
}
1112
}, [])

src/Common/Types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Placement } from 'tippy.js'
1919
import { ImageComment, ReleaseTag } from './ImageTags.Types'
2020
import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.'
2121
import { RegistryType } from '../Shared'
22+
import { TippyProps as TippyJSProps } from '@tippyjs/react'
2223

2324
/**
2425
* Generic response type object with support for overriding the result type
@@ -935,3 +936,7 @@ export interface EnvironmentHelmResult {
935936
}
936937

937938
export type EnvironmentListHelmResponse = ResponseType<EnvironmentListHelmResult[]>
939+
940+
export interface TippyProps extends TippyJSProps {
941+
showOnTruncate?: boolean
942+
}

0 commit comments

Comments
 (0)