Skip to content

Commit bb74db5

Browse files
committed
fix(ui): remove duplicate tooltip in tag input field
Remove RiTooltip wrapper and rely on TextInput built-in error tooltip to fix misaligned tooltip text colors. Move types to dedicated file. References: #RI-7779
1 parent e9ea682 commit bb74db5

File tree

2 files changed

+37
-39
lines changed

2 files changed

+37
-39
lines changed

redisinsight/ui/src/pages/home/components/database-manage-tags-modal/TagInputField.tsx

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
import React, { useState } from 'react'
22

3-
import { RiTooltip } from 'uiSrc/components'
43
import { TextInput } from 'uiSrc/components/base/inputs'
54
import { TagSuggestions } from './TagSuggestions'
6-
7-
type TagInputFieldProps = {
8-
value: string
9-
disabled?: boolean
10-
currentTagKeys: Set<string>
11-
suggestedTagKey?: string
12-
rightContent?: React.ReactNode
13-
errorMessage?: string
14-
placeholder?: string
15-
onChange: (value: string) => void
16-
}
5+
import { TagInputFieldProps } from './TagInputField.types'
176

187
export const TagInputField = ({
198
value,
@@ -30,35 +19,33 @@ export const TagInputField = ({
3019

3120
return (
3221
<div>
33-
<RiTooltip content={errorMessage} position="top">
34-
<TextInput
35-
value={value}
36-
disabled={disabled}
37-
valid={!isInvalid ? false : undefined}
38-
error={isInvalid ? errorMessage : undefined}
39-
onChange={(value) => onChange(value)}
40-
placeholder={placeholder}
41-
onFocusCapture={() => {
42-
setIsFocused(true)
43-
}}
44-
onBlurCapture={() => {
45-
setTimeout(() => {
46-
isFocused && setIsFocused(false)
47-
}, 150)
22+
<TextInput
23+
value={value}
24+
disabled={disabled}
25+
valid={!isInvalid ? false : undefined}
26+
error={isInvalid ? errorMessage : undefined}
27+
onChange={(value) => onChange(value)}
28+
placeholder={placeholder}
29+
onFocusCapture={() => {
30+
setIsFocused(true)
31+
}}
32+
onBlurCapture={() => {
33+
setTimeout(() => {
34+
isFocused && setIsFocused(false)
35+
}, 150)
36+
}}
37+
/>
38+
{isFocused && !isInvalid && (
39+
<TagSuggestions
40+
targetKey={suggestedTagKey}
41+
searchTerm={value}
42+
currentTagKeys={currentTagKeys}
43+
onChange={(value) => {
44+
setIsFocused(false)
45+
onChange(value)
4846
}}
4947
/>
50-
{isFocused && !isInvalid && (
51-
<TagSuggestions
52-
targetKey={suggestedTagKey}
53-
searchTerm={value}
54-
currentTagKeys={currentTagKeys}
55-
onChange={(value) => {
56-
setIsFocused(false)
57-
onChange(value)
58-
}}
59-
/>
60-
)}
61-
</RiTooltip>
48+
)}
6249
{rightContent}
6350
</div>
6451
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export type TagInputFieldProps = {
2+
value: string
3+
disabled?: boolean
4+
currentTagKeys: Set<string>
5+
suggestedTagKey?: string
6+
rightContent?: React.ReactNode
7+
errorMessage?: string
8+
placeholder?: string
9+
onChange: (value: string) => void
10+
}
11+

0 commit comments

Comments
 (0)