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
a06f8857
Unverified
Commit
a06f8857
authored
Jan 05, 2023
by
eddie
Committed by
GitHub
Jan 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: adjust the styling of BalanceSummary component to match design (#5755)
parent
de7cfc93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
16 deletions
+49
-16
BalanceSummary.tsx
src/components/Tokens/TokenDetails/BalanceSummary.tsx
+49
-16
No files found.
src/components/Tokens/TokenDetails/BalanceSummary.tsx
View file @
a06f8857
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
SupportedChainId
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
styled
from
'
styled-components/macro
'
import
styled
,
{
useTheme
}
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
const
BalancesCard
=
styled
.
div
`
const
BalancesCard
=
styled
.
div
`
box-shadow:
${({
theme
})
=>
theme
.
shallowShadow
}
;
box-shadow:
${({
theme
})
=>
theme
.
shallowShadow
}
;
...
@@ -14,9 +17,7 @@ const BalancesCard = styled.div`
...
@@ -14,9 +17,7 @@ const BalancesCard = styled.div`
border-radius: 16px;
border-radius: 16px;
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
display: none;
display: none;
font-size: 12px;
height: fit-content;
height: fit-content;
line-height: 16px;
padding: 20px;
padding: 20px;
width: 100%;
width: 100%;
...
@@ -35,33 +36,65 @@ const BalanceRow = styled.div`
...
@@ -35,33 +36,65 @@ const BalanceRow = styled.div`
align-items: center;
align-items: center;
display: flex;
display: flex;
flex-direction: row;
flex-direction: row;
font-size: 20px;
margin-top: 20px;
justify-content: space-between;
line-height: 28px;
margin-top: 12px;
`
`
const
BalanceItem
=
styled
.
div
`
const
BalanceItem
=
styled
.
div
`
display: flex;
display: flex;
align-items: center;
align-items: center;
`
`
const
BalanceContainer
=
styled
.
div
`
display: flex;
flex-direction: column;
margin-left: 8px;
flex: 1;
`
const
BalanceAmountsContainer
=
styled
.
div
`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
`
const
StyledNetworkLabel
=
styled
.
div
`
color:
${({
color
})
=>
color
}
;
font-size: 12px;
line-height: 16px;
`
export
default
function
BalanceSummary
({
token
}:
{
token
:
Currency
})
{
export
default
function
BalanceSummary
({
token
}:
{
token
:
Currency
})
{
const
{
account
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
theme
=
useTheme
()
const
{
label
,
color
}
=
getChainInfo
(
isSupportedChain
(
chainId
)
?
chainId
:
SupportedChainId
.
MAINNET
)
const
balance
=
useCurrencyBalance
(
account
,
token
)
const
balance
=
useCurrencyBalance
(
account
,
token
)
const
formattedBalance
=
formatCurrencyAmount
(
balance
,
NumberType
.
TokenNonTx
)
const
formattedBalance
=
formatCurrencyAmount
(
balance
,
NumberType
.
TokenNonTx
)
const
formattedUsdValue
=
formatCurrencyAmount
(
useStablecoinValue
(
balance
),
NumberType
.
FiatTokenStats
)
const
formattedUsdValue
=
formatCurrencyAmount
(
useStablecoinValue
(
balance
),
NumberType
.
FiatTokenStats
)
if
(
!
account
||
!
balance
)
return
null
if
(
!
account
||
!
balance
)
{
return
null
}
return
(
return
(
<
BalancesCard
>
<
BalancesCard
>
<
BalanceSection
>
<
BalanceSection
>
<
Trans
>
Your balance
</
Trans
>
<
ThemedText
.
SubHeaderSmall
color=
{
theme
.
textPrimary
}
>
<
Trans
>
Your balance on
{
label
}
</
Trans
>
</
ThemedText
.
SubHeaderSmall
>
<
BalanceRow
>
<
BalanceRow
>
<
BalanceItem
>
<
CurrencyLogo
currency=
{
token
}
size=
"2rem"
/>
<
CurrencyLogo
currency=
{
token
}
/>
<
BalanceContainer
>
{
formattedBalance
}
{
token
.
symbol
}
<
BalanceAmountsContainer
>
</
BalanceItem
>
<
BalanceItem
>
<
BalanceItem
>
{
formattedUsdValue
}
</
BalanceItem
>
<
ThemedText
.
SubHeader
>
{
formattedBalance
}
{
token
.
symbol
}
</
ThemedText
.
SubHeader
>
</
BalanceItem
>
<
BalanceItem
>
<
ThemedText
.
BodyPrimary
>
{
formattedUsdValue
}
</
ThemedText
.
BodyPrimary
>
</
BalanceItem
>
</
BalanceAmountsContainer
>
<
StyledNetworkLabel
color=
{
color
}
>
{
label
}
</
StyledNetworkLabel
>
</
BalanceContainer
>
</
BalanceRow
>
</
BalanceRow
>
</
BalanceSection
>
</
BalanceSection
>
</
BalancesCard
>
</
BalancesCard
>
...
...
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