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
2fe4ddbd
Commit
2fe4ddbd
authored
Jun 02, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor nav link to separate component and add some styles
parent
3afcdfae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
10 deletions
+53
-10
AccountNav.tsx
components/AccountNav/AccountNav.tsx
+23
-10
AccountNavLink.tsx
components/AccountNav/AccountNavLink.tsx
+30
-0
No files found.
components/AccountNav/AccountNav.tsx
View file @
2fe4ddbd
import
React
from
'
react
'
;
import
{
Flex
,
Link
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
{
VStack
,
Text
}
from
'
@chakra-ui/react
'
;
import
AccountNavLink
from
'
./AccountNavLink
'
;
const
navItems
=
[
{
text
:
'
Watchlist
'
,
pathname
:
'
/watchlist
'
},
{
text
:
'
Private tags
'
,
pathname
:
'
/private-tags
'
},
{
text
:
'
Public tags
'
,
pathname
:
'
/public-tags
'
},
{
text
:
'
API keys
'
,
pathname
:
'
/api-keys
'
},
{
text
:
'
Custom ABI
'
,
pathname
:
'
/custom-abi
'
},
]
const
AccountNav
=
()
=>
{
return
(
<
Flex
w=
"250px"
flexDirection=
"column"
color=
"blue.600"
>
<
NextLink
href=
"/"
passHref
><
Link
padding=
"8px 0px"
>
Home
</
Link
></
NextLink
>
<
NextLink
href=
"/watchlist"
passHref
><
Link
padding=
"8px 0px"
>
Watchlist
</
Link
></
NextLink
>
</
Flex
>
<
VStack
alignItems=
"flex-start"
spacing=
"4"
>
<
Text
paddingLeft=
"16px"
fontSize=
"12px"
lineHeight=
"20px"
color=
"gray.600"
>
Watch List
&
Notes
</
Text
>
<
VStack
spacing=
"3"
>
{
navItems
.
map
((
item
)
=>
<
AccountNavLink
key=
{
item
.
text
}
{
...
item
}
/>)
}
</
VStack
>
</
VStack
>
)
}
...
...
components/AccountNav/AccountNavLink.tsx
0 → 100644
View file @
2fe4ddbd
import
React
from
'
react
'
;
import
{
Link
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
{
useRouter
}
from
'
next/router
'
;
interface
Props
{
pathname
:
string
;
text
:
string
;
}
const
AccountNavLink
=
({
text
,
pathname
}:
Props
)
=>
{
const
router
=
useRouter
();
const
isActive
=
router
.
pathname
===
pathname
;
return
(
<
NextLink
href=
{
pathname
}
passHref
>
<
Link
w=
"220px"
p=
"15px 20px"
color=
{
isActive
?
'
white
'
:
'
black
'
}
bgColor=
{
isActive
?
'
green.700
'
:
'
transparent
'
}
borderRadius=
"10px"
>
{
text
}
</
Link
>
</
NextLink
>
)
}
export
default
AccountNavLink
;
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