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
30c12294
Commit
30c12294
authored
Jul 09, 2022
by
tom
Committed by
isstuev
Jul 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
color mode configuration
parent
af043c03
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
30 deletions
+41
-30
_document.tsx
pages/_document.tsx
+3
-0
config.ts
theme/config.ts
+8
-0
index.ts
theme/index.ts
+2
-0
Page.tsx
ui/Page/Page.tsx
+22
-26
Header.tsx
ui/header/Header.tsx
+6
-4
No files found.
pages/_document.tsx
View file @
30c12294
import
React
from
'
react
'
;
import
Document
,
{
Html
,
Head
,
Main
,
NextScript
}
from
'
next/document
'
import
{
ColorModeScript
}
from
'
@chakra-ui/react
'
;
import
theme
from
'
../theme
'
class
MyDocument
extends
Document
{
render
()
{
...
...
@@ -16,6 +18,7 @@ class MyDocument extends Document {
/>
</
Head
>
<
body
>
<
ColorModeScript
initialColorMode=
{
theme
.
config
.
initialColorMode
}
/>
<
Main
/>
<
NextScript
/>
</
body
>
...
...
theme/config.ts
0 → 100644
View file @
30c12294
import
{
type
ThemeConfig
}
from
'
@chakra-ui/react
'
;
const
config
:
ThemeConfig
=
{
initialColorMode
:
'
system
'
,
useSystemColorMode
:
false
,
}
export
default
config
;
theme/index.ts
View file @
30c12294
...
...
@@ -4,12 +4,14 @@ import typography from './foundations/typography';
import
borders
from
'
./foundations/borders
'
;
import
colors
from
'
./foundations/colors
'
;
import
components
from
'
./components/index
'
;
import
config
from
'
./config
'
;
const
overrides
=
{
...
typography
,
...
borders
,
colors
,
components
,
config
,
}
export
default
extendTheme
(
overrides
);
ui/Page/Page.tsx
View file @
30c12294
import
React
from
'
react
'
;
import
{
Box
,
HStack
,
LightMode
,
VStack
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
HStack
,
VStack
}
from
'
@chakra-ui/react
'
;
import
Navigation
from
'
../navigation/Navigation
'
;
import
Header
from
'
../header/Header
'
;
...
...
@@ -10,31 +10,27 @@ interface Props {
const
Page
=
({
children
}:
Props
)
=>
{
return
(
<
LightMode
>
<
HStack
w=
"100%"
minH=
"100vh"
bgColor=
"white"
spacing=
{
16
}
alignItems=
"stretch"
paddingRight=
"60px"
>
<
Navigation
/>
<
VStack
width=
"100%"
>
<
Header
/>
<
Box
as=
"main"
borderRadius=
"base"
w=
"100%"
overflow=
"hidden"
bgColor=
"white"
py=
{
8
}
>
{
children
}
</
Box
>
</
VStack
>
</
HStack
>
</
LightMode
>
<
HStack
w=
"100%"
minH=
"100vh"
spacing=
{
16
}
alignItems=
"stretch"
paddingRight=
"60px"
>
<
Navigation
/>
<
VStack
width=
"100%"
>
<
Header
/>
<
Box
as=
"main"
borderRadius=
"base"
w=
"100%"
overflow=
"hidden"
py=
{
8
}
>
{
children
}
</
Box
>
</
VStack
>
</
HStack
>
);
};
...
...
ui/header/Header.tsx
View file @
30c12294
import
React
from
'
react
'
;
import
{
Box
,
HStack
,
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Center
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Center
,
Switch
,
useColorMode
}
from
'
@chakra-ui/react
'
;
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
import
Identicon
from
'
react-identicons
'
;
import
styles
from
'
./Header.module.css
'
;
const
AccountNav
=
()
=>
{
const
Header
=
()
=>
{
const
{
toggleColorMode
}
=
useColorMode
();
return
(
<
HStack
as=
"header"
...
...
@@ -23,7 +25,7 @@ const AccountNav = () => {
</
InputLeftElement
>
<
Input
paddingInlineStart=
"50px"
placeholder=
"Search by addresses / transactions /block/ token ... "
/>
</
InputGroup
>
<
Box
>
Switch
</
Box
>
<
Switch
size=
"lg"
onChange=
{
toggleColorMode
}
/
>
<
Center
minWidth=
"50px"
width=
"50px"
height=
"50px"
bg=
"blackAlpha.100"
borderRadius=
"50%"
overflow=
"hidden"
>
{
/* the displayed size is 40px, but we need to generate x2 for retina displays */
}
<
Identicon
className=
{
styles
.
identicon
}
string=
"randomness"
size=
{
80
}
/>
...
...
@@ -32,4 +34,4 @@ const AccountNav = () => {
)
}
export
default
AccountNav
;
export
default
Header
;
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