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
0b4f1762
Commit
0b4f1762
authored
Aug 13, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring search bar to life
parent
c2996843
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
11 deletions
+46
-11
global.ts
theme/global.ts
+3
-0
ColorModeToggler.tsx
ui/header/ColorModeToggler.tsx
+3
-1
Header.tsx
ui/header/Header.tsx
+4
-10
SearchBar.tsx
ui/header/SearchBar.tsx
+36
-0
No files found.
theme/global.ts
View file @
0b4f1762
...
@@ -8,6 +8,9 @@ const global = (props: StyleFunctionProps) => ({
...
@@ -8,6 +8,9 @@ const global = (props: StyleFunctionProps) => ({
bg
:
mode
(
'
white
'
,
'
black
'
)(
props
),
bg
:
mode
(
'
white
'
,
'
black
'
)(
props
),
...
getDefaultTransitionProps
(),
...
getDefaultTransitionProps
(),
},
},
form
:
{
w
:
'
100%
'
,
},
});
});
export
default
global
;
export
default
global
;
ui/header/ColorModeToggler.tsx
View file @
0b4f1762
...
@@ -25,7 +25,7 @@ export interface ColorModeTogglerProps
...
@@ -25,7 +25,7 @@ export interface ColorModeTogglerProps
ThemingProps
<
'
Switch
'
>
{
ThemingProps
<
'
Switch
'
>
{
}
}
export
const
ColorModeToggler
=
forwardRef
<
ColorModeTogglerProps
,
'
input
'
>
((
props
,
ref
)
=>
{
const
ColorModeToggler
=
forwardRef
<
ColorModeTogglerProps
,
'
input
'
>
((
props
,
ref
)
=>
{
const
ownProps
=
omitThemingProps
(
props
);
const
ownProps
=
omitThemingProps
(
props
);
const
{
toggleColorMode
,
colorMode
}
=
useColorMode
();
const
{
toggleColorMode
,
colorMode
}
=
useColorMode
();
...
@@ -91,3 +91,5 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
...
@@ -91,3 +91,5 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
if
(
__DEV__
)
{
if
(
__DEV__
)
{
ColorModeToggler
.
displayName
=
'
ColorModeToggler
'
;
ColorModeToggler
.
displayName
=
'
ColorModeToggler
'
;
}
}
export
default
ColorModeToggler
;
ui/header/Header.tsx
View file @
0b4f1762
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
HStack
,
Center
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Center
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
Identicon
from
'
react-identicons
'
;
import
Identicon
from
'
react-identicons
'
;
import
{
ColorModeToggler
}
from
'
./ColorModeToggler
'
;
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
import
styles
from
'
./Header.module.css
'
;
import
styles
from
'
./Header.module.css
'
;
import
SearchBar
from
'
./SearchBar
'
;
const
Header
=
()
=>
{
const
Header
=
()
=>
{
return
(
return
(
...
@@ -17,13 +17,7 @@ const Header = () => {
...
@@ -17,13 +17,7 @@ const Header = () => {
marginTop=
{
9
}
marginTop=
{
9
}
gap=
{
12
}
gap=
{
12
}
>
>
<
InputGroup
>
<
SearchBar
/>
<
InputLeftAddon
w=
"111px"
>
All filters
</
InputLeftAddon
>
<
InputLeftElement
w=
{
6
}
ml=
"132px"
mr=
{
2.5
}
>
<
SearchIcon
w=
{
5
}
h=
{
5
}
color=
{
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
)
}
/>
</
InputLeftElement
>
<
Input
paddingInlineStart=
"50px"
placeholder=
"Search by addresses / transactions / block / token... "
ml=
"1px"
/>
</
InputGroup
>
<
ColorModeToggler
/>
<
ColorModeToggler
/>
<
Center
minWidth=
"50px"
width=
"50px"
height=
"50px"
bg=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
white
'
)
}
borderRadius=
"50%"
overflow=
"hidden"
>
<
Center
minWidth=
"50px"
width=
"50px"
height=
"50px"
bg=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
white
'
)
}
borderRadius=
"50%"
overflow=
"hidden"
>
{
/* the displayed size is 48px, but we need to generate x2 for retina displays */
}
{
/* the displayed size is 48px, but we need to generate x2 for retina displays */
}
...
...
ui/header/SearchBar.tsx
0 → 100644
View file @
0b4f1762
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
React
from
'
react
'
;
const
SearchBar
=
()
=>
{
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setValue
(
event
.
target
.
value
);
},
[]);
const
handleSubmit
=
React
.
useCallback
((
event
:
FormEvent
<
HTMLFormElement
>
)
=>
{
event
.
preventDefault
();
window
.
location
.
assign
(
`https://blockscout.com/xdai/mainnet/search-results?q=
${
value
}
`
);
},
[
value
]);
return
(
<
form
noValidate
onSubmit=
{
handleSubmit
}
>
<
InputGroup
>
<
InputLeftAddon
w=
"111px"
>
All filters
</
InputLeftAddon
>
<
InputLeftElement
w=
{
6
}
ml=
"132px"
mr=
{
2.5
}
>
<
SearchIcon
w=
{
5
}
h=
{
5
}
color=
{
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
)
}
/>
</
InputLeftElement
>
<
Input
paddingInlineStart=
"50px"
placeholder=
"Search by addresses / transactions / block / token... "
ml=
"1px"
onChange=
{
handleChange
}
/>
</
InputGroup
>
</
form
>
);
};
export
default
SearchBar
;
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