Skip to content

Commit 7f2997f

Browse files
committed
fix: review comments
1 parent 97020c2 commit 7f2997f

File tree

10 files changed

+18
-55
lines changed

10 files changed

+18
-55
lines changed

src/Common/AddCDButton/AddCDButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react'
1817
import Tippy from '@tippyjs/react'
1918
import { AddCDButtonProps, TooltipContentProps } from './types'
2019
import { AddCDPositions } from '../Types'

src/Common/RJSF/common/FieldRow.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react'
18-
import { ConditionalWrap } from '../../Helper'
17+
import { Tooltip } from '@Common/Tooltip'
1918
import { FieldRowProps } from './types'
2019
import { DEFAULT_FIELD_TITLE } from '../constants'
21-
import { getTippyWrapperWithContent } from '../utils'
2220

2321
export const FieldRowWithLabel = ({
2422
showLabel,
@@ -38,11 +36,11 @@ export const FieldRowWithLabel = ({
3836
>
3937
{showLabel && (
4038
<label className="cn-7 fs-13 lh-20 fw-4 flexbox mb-0" htmlFor={id}>
41-
<ConditionalWrap condition={!!rawDescription} wrap={getTippyWrapperWithContent(rawDescription, 'top')}>
39+
<Tooltip alwaysShowTippyOnHover={!!rawDescription}>
4240
<span className={`dc__ellipsis-right ${rawDescription ? 'text-underline-dashed-300' : ''}`}>
4341
{label || DEFAULT_FIELD_TITLE}
4442
</span>
45-
</ConditionalWrap>
43+
</Tooltip>
4644
{required && <span className="cr-5">&nbsp;*</span>}
4745
</label>
4846
)}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { IconButtonProps } from '@rjsf/utils'
1818

19-
import Tippy from '../../../Tippy'
19+
import Tooltip from '../../../Tooltip/Tooltip'
2020
import { ReactComponent as PlusIcon } from '../../../../Assets/Icon/ic-add.svg'
2121

2222
export const AddButton = ({
@@ -31,7 +31,7 @@ export const AddButton = ({
3131

3232
return (
3333
<div className="flexbox flex-justify-start">
34-
<Tippy
34+
<Tooltip
3535
showOnTruncate
3636
className="default-tt dc__word-break"
3737
arrow={false}
@@ -47,7 +47,7 @@ export const AddButton = ({
4747
<PlusIcon className="icon-dim-16 fcb-5" />
4848
<span className="cb-5 fs-13 lh-34 dc__truncate">{content}</span>
4949
</button>
50-
</Tippy>
50+
</Tooltip>
5151
</div>
5252
)
5353
}

src/Common/RJSF/templates/TitleField.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react'
18-
import { ConditionalWrap } from '../../Helper'
1917
import { TitleFieldProps } from '@rjsf/utils'
20-
import { getTippyWrapperWithContent } from '../utils'
18+
import { Tooltip } from '@Common/Tooltip'
2119

2220
export const TitleField = ({ id, title, required, description }: TitleFieldProps & Partial<Record<'description', string>>) => (
2321
<legend className="fs-13 fw-6 cn-9 lh-20 dc__no-border py-9 mb-0" id={id}>
24-
<ConditionalWrap condition={!!description} wrap={getTippyWrapperWithContent(description, 'top')}>
22+
<Tooltip alwaysShowTippyOnHover={!!description}>
2523
<span className={`${description ? 'text-underline-dashed-300' : ''}`}>{title}</span>
26-
</ConditionalWrap>
24+
</Tooltip>
2725
{required && <span className="cr-5">&nbsp;*</span>}
2826
</legend>
2927
)

src/Common/RJSF/utils.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
import { TranslatableString, englishStringTranslator } from '@rjsf/utils'
18-
import Tippy from '../Tippy'
1918

2019
/**
2120
* Override for the TranslatableString from RJSF
@@ -136,10 +135,3 @@ export const getInferredTypeFromValueType = (value) => {
136135
return 'null'
137136
}
138137
}
139-
140-
export const getTippyWrapperWithContent =
141-
(content, placement?: React.ComponentProps<typeof Tippy>['placement']) => (children) => (
142-
<Tippy className="default-tt" maxWidth={300} arrow={false} placement={placement || 'right'} content={content}>
143-
{children}
144-
</Tippy>
145-
)

src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Tippy } from '..'
17+
import { Tooltip } from '@Common/Tooltip'
1818
import { ReactComponent as SortIcon } from '../../Assets/Icon/ic-arrow-up-down.svg'
1919
import { ReactComponent as SortArrowDown } from '../../Assets/Icon/ic-sort-arrow-down.svg'
2020
import { SortingOrder } from '../Constants'
@@ -63,19 +63,19 @@ const SortableTableHeaderCell = ({
6363
return (
6464
<button
6565
type="button"
66-
className="dc__transparent p-0 bcn-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text"
66+
className="dc__transparent p-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text"
6767
onClick={isSortable ? triggerSorting : noop}
6868
disabled={disabled}
6969
>
70-
<Tippy
70+
<Tooltip
7171
showOnTruncate={showTippyOnTruncate}
7272
className="default-tt"
7373
placement="top"
7474
arrow={false}
7575
content={title}
7676
>
7777
<span className="dc__uppercase dc__ellipsis-right">{title}</span>
78-
</Tippy>
78+
</Tooltip>
7979
{renderSortIcon()}
8080
</button>
8181
)

src/Common/SortableTableHeaderCell/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,9 @@ export interface SortableTableHeaderCellProps {
4444
* @default true
4545
*/
4646
isSortable?: boolean
47+
/**
48+
* If true, the tippy is shown on Sortable header if text is truncated
49+
* @default false
50+
*/
4751
showTippyOnTruncate?: boolean
4852
}

src/Common/Tippy.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Common/Types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ 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'
2322

2423
/**
2524
* Generic response type object with support for overriding the result type
@@ -936,7 +935,3 @@ export interface EnvironmentHelmResult {
936935
}
937936

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

src/Common/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ export * from './GenericDescription'
7171
export * from './SegmentedBarChart'
7272
export * from './CodeEditor'
7373
export * from './AppStatus'
74-
export { default as Tippy } from './Tippy'
74+
export * from './Tooltip'

0 commit comments

Comments
 (0)