Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
3237bcb7
Commit
3237bcb7
authored
Nov 22, 2022
by
Yuri Mikhin
Committed by
Yuri Mikhin
Nov 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clear button condition in FilterInput.
parent
b6f55cae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
FilterInput.tsx
ui/shared/FilterInput.tsx
+16
-13
No files found.
ui/shared/FilterInput.tsx
View file @
3237bcb7
...
@@ -15,6 +15,7 @@ type Props = {
...
@@ -15,6 +15,7 @@ type Props = {
const
FilterInput
=
({
onChange
,
className
,
size
=
'
sm
'
,
placeholder
}:
Props
)
=>
{
const
FilterInput
=
({
onChange
,
className
,
size
=
'
sm
'
,
placeholder
}:
Props
)
=>
{
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
''
);
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
''
);
const
inputRef
=
React
.
useRef
<
HTMLInputElement
>
(
null
);
const
inputRef
=
React
.
useRef
<
HTMLInputElement
>
(
null
);
const
iconColor
=
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
);
const
handleFilterQueryChange
=
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleFilterQueryChange
=
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
{
value
}
=
event
.
target
;
const
{
value
}
=
event
.
target
;
...
@@ -37,7 +38,7 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
...
@@ -37,7 +38,7 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
<
InputLeftElement
<
InputLeftElement
pointerEvents=
"none"
pointerEvents=
"none"
>
>
<
Icon
as=
{
searchIcon
}
color=
{
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
)
}
/>
<
Icon
as=
{
searchIcon
}
color=
{
iconColor
}
/>
</
InputLeftElement
>
</
InputLeftElement
>
<
Input
<
Input
...
@@ -50,18 +51,20 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
...
@@ -50,18 +51,20 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
textOverflow=
"ellipsis"
textOverflow=
"ellipsis"
/>
/>
<
InputRightElement
>
{
filterQuery
?
(
<
IconButton
<
InputRightElement
>
colorScheme=
"gray"
<
IconButton
aria
-
label=
"Clear the filter input"
colorScheme=
"gray"
title=
"Clear the filter input"
aria
-
label=
"Clear the filter input"
w=
{
6
}
title=
"Clear the filter input"
h=
{
6
}
w=
{
6
}
icon=
{
<
Icon
as=
{
crossIcon
}
w=
{
4
}
h=
{
4
}
color=
{
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
)
}
/>
}
h=
{
6
}
size=
"sm"
icon=
{
<
Icon
as=
{
crossIcon
}
w=
{
4
}
h=
{
4
}
color=
{
iconColor
}
/>
}
onClick=
{
handleFilterQueryClear
}
size=
"sm"
/>
onClick=
{
handleFilterQueryClear
}
</
InputRightElement
>
/>
</
InputRightElement
>
)
:
null
}
</
InputGroup
>
</
InputGroup
>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment