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
0385fabf
Commit
0385fabf
authored
Aug 26, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search bar styles
parent
553d47e6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
13 deletions
+124
-13
Input.ts
theme/components/Input.ts
+12
-0
Header.tsx
ui/header/Header.tsx
+17
-12
SearchBar.tsx
ui/header/searchBar/SearchBar.tsx
+39
-0
SearchBarDesktop.tsx
ui/header/searchBar/SearchBarDesktop.tsx
+28
-0
SearchBarMobile.tsx
ui/header/searchBar/SearchBarMobile.tsx
+27
-0
Page.tsx
ui/shared/Page/Page.tsx
+1
-1
No files found.
theme/components/Input.ts
View file @
0385fabf
...
@@ -8,6 +8,14 @@ import getDefaultTransitionProps from '../utils/getDefaultTransitionProps';
...
@@ -8,6 +8,14 @@ import getDefaultTransitionProps from '../utils/getDefaultTransitionProps';
import
getOutlinedFieldStyles
from
'
../utils/getOutlinedFieldStyles
'
;
import
getOutlinedFieldStyles
from
'
../utils/getOutlinedFieldStyles
'
;
const
sizes
:
Record
<
string
,
SystemStyleObject
>
=
{
const
sizes
:
Record
<
string
,
SystemStyleObject
>
=
{
sm
:
{
fontSize
:
'
md
'
,
lineHeight
:
'
24px
'
,
px
:
'
8px
'
,
py
:
'
12px
'
,
h
:
'
40px
'
,
borderRadius
:
'
base
'
,
},
md
:
{
md
:
{
fontSize
:
'
md
'
,
fontSize
:
'
md
'
,
lineHeight
:
'
20px
'
,
lineHeight
:
'
20px
'
,
...
@@ -43,6 +51,10 @@ const variantOutline: PartsStyleFunction<typeof parts> = (props) => {
...
@@ -43,6 +51,10 @@ const variantOutline: PartsStyleFunction<typeof parts> = (props) => {
const
Input
:
ComponentStyleConfig
=
{
const
Input
:
ComponentStyleConfig
=
{
sizes
:
{
sizes
:
{
sm
:
{
field
:
sizes
.
sm
,
addon
:
sizes
.
sm
,
},
md
:
{
md
:
{
field
:
sizes
.
md
,
field
:
sizes
.
md
,
addon
:
sizes
.
md
,
addon
:
sizes
.
md
,
...
...
ui/header/Header.tsx
View file @
0385fabf
import
{
HStack
,
Flex
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
VStack
,
Flex
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
...
@@ -7,7 +7,7 @@ import NetworkLogo from 'ui/navigation/NetworkLogo';
...
@@ -7,7 +7,7 @@ import NetworkLogo from 'ui/navigation/NetworkLogo';
import
Burger
from
'
./Burger
'
;
import
Burger
from
'
./Burger
'
;
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
import
ProfileMenu
from
'
./ProfileMenu
'
;
import
ProfileMenu
from
'
./ProfileMenu
'
;
import
SearchBar
from
'
./SearchBar
'
;
import
SearchBar
from
'
./
searchBar/
SearchBar
'
;
const
Header
=
()
=>
{
const
Header
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
...
@@ -15,22 +15,27 @@ const Header = () => {
...
@@ -15,22 +15,27 @@ const Header = () => {
if
(
isMobile
)
{
if
(
isMobile
)
{
return
(
return
(
<
Flex
<
VStack
as=
"header"
as=
"header"
width=
"100%"
alignItems=
"center"
justifyContent=
"space-between"
position=
"fixed"
position=
"fixed"
bgColor=
{
bgColor
}
top=
{
0
}
top=
{
0
}
left=
{
0
}
left=
{
0
}
paddingX=
{
4
}
paddingX=
{
4
}
paddingTop=
{
2
}
paddingY=
{
2
}
bgColor=
{
bgColor
}
width=
"100%"
>
>
<
Burger
/>
<
Flex
<
NetworkLogo
/>
width=
"100%"
<
ProfileMenu
/>
alignItems=
"center"
</
Flex
>
justifyContent=
"space-between"
>
<
Burger
/>
<
NetworkLogo
/>
<
ProfileMenu
/>
</
Flex
>
<
SearchBar
/>
</
VStack
>
);
);
}
}
...
...
ui/header/SearchBar.tsx
→
ui/header/
searchBar/
SearchBar.tsx
View file @
0385fabf
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useBasePath
from
'
lib/hooks/useBasePath
'
;
import
useBasePath
from
'
lib/hooks/useBasePath
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
SearchBarDesktop
from
'
./SearchBarDesktop
'
;
import
SearchBarMobile
from
'
./SearchBarMobile
'
;
const
SearchBar
=
()
=>
{
const
SearchBar
=
()
=>
{
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
basePath
=
useBasePath
();
const
basePath
=
useBasePath
();
const
isMobile
=
useIsMobile
();
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setValue
(
event
.
target
.
value
);
setValue
(
event
.
target
.
value
);
...
@@ -18,21 +21,17 @@ const SearchBar = () => {
...
@@ -18,21 +21,17 @@ const SearchBar = () => {
window
.
location
.
assign
(
`https://blockscout.com
${
basePath
}
/search-results?q=
${
value
}
`
);
window
.
location
.
assign
(
`https://blockscout.com
${
basePath
}
/search-results?q=
${
value
}
`
);
},
[
value
,
basePath
]);
},
[
value
,
basePath
]);
if
(
isMobile
)
{
return
(
<
form
noValidate
onSubmit=
{
handleSubmit
}
>
<
SearchBarMobile
onChange=
{
handleChange
}
/>
</
form
>
);
}
return
(
return
(
<
form
noValidate
onSubmit=
{
handleSubmit
}
>
<
form
noValidate
onSubmit=
{
handleSubmit
}
>
<
InputGroup
>
<
SearchBarDesktop
onChange=
{
handleChange
}
/>
<
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
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
/>
</
InputGroup
>
</
form
>
</
form
>
);
);
};
};
...
...
ui/header/searchBar/SearchBarDesktop.tsx
0 → 100644
View file @
0385fabf
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
interface
Props
{
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
void
;
}
const
SearchBarDesktop
=
({
onChange
}:
Props
)
=>
{
return
(
<
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=
{
onChange
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
/>
</
InputGroup
>
);
};
export
default
React
.
memo
(
SearchBarDesktop
);
ui/header/searchBar/SearchBarMobile.tsx
0 → 100644
View file @
0385fabf
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
InputGroup
,
Input
,
InputLeftElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
interface
Props
{
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
void
;
}
const
SearchBarMobile
=
({
onChange
}:
Props
)
=>
{
return
(
<
InputGroup
size=
"sm"
>
<
InputLeftElement
>
<
SearchIcon
w=
{
4
}
h=
{
4
}
color=
{
useColorModeValue
(
'
blackAlpha.600
'
,
'
whiteAlpha.600
'
)
}
/>
</
InputLeftElement
>
<
Input
paddingInlineStart=
"38px"
placeholder=
"Search by addresses / ... "
ml=
"1px"
onChange=
{
onChange
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
/>
</
InputGroup
>
);
};
export
default
React
.
memo
(
SearchBarMobile
);
ui/shared/Page/Page.tsx
View file @
0385fabf
...
@@ -19,7 +19,7 @@ const Page = ({ children }: Props) => {
...
@@ -19,7 +19,7 @@ const Page = ({ children }: Props) => {
alignItems=
"stretch"
alignItems=
"stretch"
>
>
<
Navigation
/>
<
Navigation
/>
<
VStack
width=
"100%"
paddingX=
{
isMobile
?
4
:
8
}
paddingTop=
{
isMobile
?
12
:
9
}
>
<
VStack
width=
"100%"
paddingX=
{
isMobile
?
4
:
8
}
paddingTop=
{
isMobile
?
'
104px
'
:
9
}
>
<
Header
/>
<
Header
/>
<
Box
<
Box
as=
"main"
as=
"main"
...
...
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