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
c47464cc
Commit
c47464cc
authored
Jan 19, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add initial filter value from url
parent
2f118486
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
FilterInput.tsx
ui/shared/filters/FilterInput.tsx
+3
-2
Tokens.tsx
ui/tokens/Tokens.tsx
+10
-2
No files found.
ui/shared/filters/FilterInput.tsx
View file @
c47464cc
...
...
@@ -10,10 +10,11 @@ type Props = {
className
?:
string
;
size
?:
'
xs
'
|
'
sm
'
|
'
md
'
|
'
lg
'
;
placeholder
:
string
;
initialValue
?:
string
;
}
const
FilterInput
=
({
onChange
,
className
,
size
=
'
sm
'
,
placeholder
}:
Props
)
=>
{
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
''
);
const
FilterInput
=
({
onChange
,
className
,
size
=
'
sm
'
,
placeholder
,
initialValue
}:
Props
)
=>
{
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
initialValue
||
''
);
const
inputRef
=
React
.
useRef
<
HTMLInputElement
>
(
null
);
const
iconColor
=
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
);
...
...
ui/tokens/Tokens.tsx
View file @
c47464cc
...
...
@@ -27,7 +27,7 @@ const getTokenFilterValue = (getFilterValuesFromQuery<TokenType>).bind(null, TOK
const
Tokens
=
()
=>
{
const
router
=
useRouter
();
const
[
filter
,
setFilter
]
=
React
.
useState
<
string
>
(
''
);
const
[
filter
,
setFilter
]
=
React
.
useState
<
string
>
(
router
.
query
.
filter
?.
toString
()
||
''
);
const
[
type
,
setType
]
=
React
.
useState
<
Array
<
TokenType
>
|
undefined
>
(
getTokenFilterValue
(
router
.
query
.
type
));
const
debouncedFilter
=
useDebounce
(
filter
,
300
);
...
...
@@ -57,7 +57,15 @@ const Tokens = () => {
</
PopoverFilter
>
);
const
filterInput
=
<
FilterInput
w=
"100%"
size=
"xs"
onChange=
{
onSearchChange
}
placeholder=
"Token name or symbol"
/>;
const
filterInput
=
(
<
FilterInput
w=
"100%"
size=
"xs"
onChange=
{
onSearchChange
}
placeholder=
"Token name or symbol"
initialValue=
{
filter
}
/>
);
const
bar
=
(
<>
...
...
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