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
b49e2dc3
Commit
b49e2dc3
authored
May 27, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dropdown item refactoring
parent
46171bfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
DeFiDropdownItem.tsx
ui/snippets/topBar/DeFiDropdownItem.tsx
+31
-32
No files found.
ui/snippets/topBar/DeFiDropdownItem.tsx
View file @
b49e2dc3
import
{
Link
,
Text
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Text
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
DeFiDropdownItem
as
TDeFiDropdownItem
}
from
'
types/client/deFiDropdown
'
;
import
type
{
DeFiDropdownItem
as
TDeFiDropdownItem
}
from
'
types/client/deFiDropdown
'
;
import
type
{
Route
}
from
'
nextjs-routes
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
type
Props
=
{
type
Props
=
{
item
:
TDeFiDropdownItem
&
{
onClick
:
()
=>
void
};
item
:
TDeFiDropdownItem
&
{
onClick
:
()
=>
void
};
}
}
const
DeFiDropdownItem
=
({
item
}:
Props
)
=>
{
const
DeFiDropdownItem
=
({
item
}:
Props
)
=>
{
const
nextRoute
:
Route
=
{
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
item
.
dappId
||
''
,
action
:
'
connect
'
}
};
const
styles
=
{
const
href
=
item
.
dappId
?
route
(
nextRoute
)
:
item
.
url
;
width
:
'
100%
'
,
height
:
'
34px
'
,
display
:
'
inline-flex
'
,
alignItems
:
'
center
'
,
color
:
useColorModeValue
(
'
blackAlpha.800
'
,
'
gray.400
'
),
textDecoration
:
'
none !important
'
,
_hover
:
{
'
& *
'
:
{
color
:
'
link_hovered
'
,
},
},
};
const
content
=
(
const
content
=
(
<
Link
<>
href=
{
href
}
<
IconSvg
name=
{
item
.
icon
}
boxSize=
{
5
}
mr=
{
2
}
/>
target=
{
item
.
dappId
?
'
_self
'
:
'
_blank
'
}
<
Text
as=
"span"
fontSize=
"sm"
>
{
item
.
text
}
</
Text
>
w=
"100%"
</>
h=
"34px"
display=
"flex"
alignItems=
"center"
gap=
{
2
}
aria
-
label=
{
`${ item.text } link`
}
whiteSpace=
"nowrap"
color=
{
useColorModeValue
(
'
blackAlpha.800
'
,
'
gray.400
'
)
}
onClick=
{
item
.
onClick
}
_hover=
{
{
'
& *
'
:
{
color
:
'
link_hovered
'
,
},
}
}
>
<
IconSvg
name=
{
item
.
icon
}
boxSize=
{
5
}
/>
<
Text
as=
"span"
fontSize=
"sm"
>
<
span
>
{
item
.
text
}
</
span
>
{
!
item
.
dappId
&&
<
IconSvg
name=
"arrows/north-east"
boxSize=
{
4
}
color=
"text_secondary"
verticalAlign=
"middle"
/>
}
</
Text
>
</
Link
>
);
);
return
item
.
dappId
?
(
return
item
.
dappId
?
(
<
NextLink
href=
{
nextRoute
}
passHref
legacyBehavior
>
<
LinkInternal
href=
{
route
({
pathname
:
'
/apps/[id]
'
,
query
:
{
id
:
item
.
dappId
,
action
:
'
connect
'
}
})
}
target=
"_self"
{
...
styles
}
>
{
content
}
{
content
}
</
NextLink
>
</
LinkInternal
>
)
:
content
;
)
:
(
<
LinkExternal
href=
{
item
.
url
}
{
...
styles
}
>
{
content
}
</
LinkExternal
>
);
};
};
export
default
React
.
memo
(
DeFiDropdownItem
);
export
default
React
.
memo
(
DeFiDropdownItem
);
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