Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
f15ac091
Unverified
Commit
f15ac091
authored
Oct 25, 2022
by
Jordan Frankfurt
Committed by
GitHub
Oct 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: hover flash (#4998)
parent
6037d74c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
BagRow.tsx
src/nft/components/bag/BagRow.tsx
+6
-7
No files found.
src/nft/components/bag/BagRow.tsx
View file @
f15ac091
...
@@ -17,7 +17,7 @@ import { bodySmall } from 'nft/css/common.css'
...
@@ -17,7 +17,7 @@ import { bodySmall } from 'nft/css/common.css'
import
{
loadingBlock
}
from
'
nft/css/loading.css
'
import
{
loadingBlock
}
from
'
nft/css/loading.css
'
import
{
GenieAsset
,
UpdatedGenieAsset
}
from
'
nft/types
'
import
{
GenieAsset
,
UpdatedGenieAsset
}
from
'
nft/types
'
import
{
ethNumberStandardFormatter
,
formatWeiToDecimal
,
getAssetHref
}
from
'
nft/utils
'
import
{
ethNumberStandardFormatter
,
formatWeiToDecimal
,
getAssetHref
}
from
'
nft/utils
'
import
{
MouseEvent
,
use
Effect
,
useReducer
,
useRef
,
useState
}
from
'
react
'
import
{
MouseEvent
,
use
Callback
,
useEffect
,
useReducer
,
useState
}
from
'
react
'
import
{
Link
}
from
'
react-router-dom
'
import
{
Link
}
from
'
react-router-dom
'
import
*
as
styles
from
'
./BagRow.css
'
import
*
as
styles
from
'
./BagRow.css
'
...
@@ -53,14 +53,13 @@ interface BagRowProps {
...
@@ -53,14 +53,13 @@ interface BagRowProps {
}
}
export
const
BagRow
=
({
asset
,
usdPrice
,
removeAsset
,
showRemove
,
grayscale
,
isMobile
}:
BagRowProps
)
=>
{
export
const
BagRow
=
({
asset
,
usdPrice
,
removeAsset
,
showRemove
,
grayscale
,
isMobile
}:
BagRowProps
)
=>
{
const
[
cardHovered
,
setCardHovered
]
=
useState
(
false
)
const
[
loadedImage
,
setImageLoaded
]
=
useState
(
false
)
const
[
loadedImage
,
setImageLoaded
]
=
useState
(
false
)
const
[
noImageAvailable
,
setNoImageAvailable
]
=
useState
(
!
asset
.
smallImageUrl
)
const
[
noImageAvailable
,
setNoImageAvailable
]
=
useState
(
!
asset
.
smallImageUrl
)
const
handleCardHover
=
()
=>
setCardHovered
(
!
cardHovered
)
const
assetCardRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
showRemoveButton
=
showRemove
&&
cardHovered
if
(
cardHovered
&&
assetCardRef
.
current
&&
assetCardRef
.
current
.
matches
(
'
:hover
'
)
===
false
)
setCardHovered
(
false
)
const
[
cardHovered
,
setCardHovered
]
=
useState
(
false
)
const
handleMouseEnter
=
useCallback
(()
=>
setCardHovered
(
true
),
[])
const
handleMouseLeave
=
useCallback
(()
=>
setCardHovered
(
false
),
[])
const
showRemoveButton
=
showRemove
&&
cardHovered
const
assetEthPrice
=
asset
.
updatedPriceInfo
?
asset
.
updatedPriceInfo
.
ETHPrice
:
asset
.
priceInfo
.
ETHPrice
const
assetEthPrice
=
asset
.
updatedPriceInfo
?
asset
.
updatedPriceInfo
.
ETHPrice
:
asset
.
priceInfo
.
ETHPrice
const
assetEthPriceFormatted
=
formatWeiToDecimal
(
assetEthPrice
)
const
assetEthPriceFormatted
=
formatWeiToDecimal
(
assetEthPrice
)
...
@@ -71,7 +70,7 @@ export const BagRow = ({ asset, usdPrice, removeAsset, showRemove, grayscale, is
...
@@ -71,7 +70,7 @@ export const BagRow = ({ asset, usdPrice, removeAsset, showRemove, grayscale, is
return
(
return
(
<
Link
to=
{
getAssetHref
(
asset
)
}
style=
{
{
textDecoration
:
'
none
'
}
}
>
<
Link
to=
{
getAssetHref
(
asset
)
}
style=
{
{
textDecoration
:
'
none
'
}
}
>
<
Row
ref=
{
assetCardRef
}
className=
{
styles
.
bagRow
}
onMouseEnter=
{
handleCardHover
}
onMouseLeave=
{
handleCardHover
}
>
<
Row
className=
{
styles
.
bagRow
}
onMouseEnter=
{
handleMouseEnter
}
onMouseLeave=
{
handleMouseLeave
}
>
<
Box
position=
"relative"
display=
"flex"
>
<
Box
position=
"relative"
display=
"flex"
>
<
Box
<
Box
display=
{
showRemove
&&
isMobile
?
'
block
'
:
'
none
'
}
display=
{
showRemove
&&
isMobile
?
'
block
'
:
'
none
'
}
...
...
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