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
faad6472
Commit
faad6472
authored
Jan 04, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear button
parent
d0f5a962
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
FilterInput.tsx
ui/shared/FilterInput.tsx
+3
-12
InputClearButton.tsx
ui/shared/InputClearButton.tsx
+26
-0
No files found.
ui/shared/FilterInput.tsx
View file @
faad6472
import
{
chakra
,
Icon
,
I
conButton
,
I
nput
,
InputGroup
,
InputLeftElement
,
InputRightElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
chakra
,
Icon
,
Input
,
InputGroup
,
InputLeftElement
,
InputRightElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
crossIcon
from
'
icons/cross.svg
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
InputClearButton
from
'
ui/shared/InputClearButton
'
;
type
Props
=
{
type
Props
=
{
onChange
:
(
searchTerm
:
string
)
=>
void
;
onChange
:
(
searchTerm
:
string
)
=>
void
;
...
@@ -54,16 +54,7 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
...
@@ -54,16 +54,7 @@ const FilterInput = ({ onChange, className, size = 'sm', placeholder }: Props) =
{
filterQuery
?
(
{
filterQuery
?
(
<
InputRightElement
>
<
InputRightElement
>
<
IconButton
<
InputClearButton
onClick=
{
handleFilterQueryClear
}
/>
colorScheme=
"gray"
aria
-
label=
"Clear the filter input"
title=
"Clear the filter input"
w=
{
6
}
h=
{
6
}
icon=
{
<
Icon
as=
{
crossIcon
}
w=
{
4
}
h=
{
4
}
color=
{
iconColor
}
/>
}
size=
"sm"
onClick=
{
handleFilterQueryClear
}
/>
</
InputRightElement
>
</
InputRightElement
>
)
:
null
}
)
:
null
}
</
InputGroup
>
</
InputGroup
>
...
...
ui/shared/InputClearButton.tsx
0 → 100644
View file @
faad6472
import
{
chakra
,
Icon
,
IconButton
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
crossIcon
from
'
icons/cross.svg
'
;
interface
Props
{
onClick
:
()
=>
void
;
}
const
InputClearButton
=
({
onClick
}:
Props
)
=>
{
const
iconColor
=
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
);
return
(
<
IconButton
colorScheme=
"gray"
aria
-
label=
"Clear input"
title=
"Clear input"
boxSize=
{
6
}
icon=
{
<
Icon
as=
{
crossIcon
}
boxSize=
{
4
}
color=
{
iconColor
}
/>
}
size=
"sm"
onClick=
{
onClick
}
/>
);
};
export
default
chakra
(
InputClearButton
);
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