Skip to content

Commit

Permalink
fix(market-overview): pricechange percent (#2533)
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv authored Sep 17, 2024
1 parent 88c0520 commit e7cd115
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/pages/MarketOverview/DetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Star, X } from 'react-feather'
import { useMedia, usePreviousDistinct } from 'react-use'
import { Box, Flex, Text } from 'rebass'
import { AssetToken, useGetQuoteByChainQuery } from 'services/marketOverview'
import styled from 'styled-components'

import { ButtonEmpty, ButtonOutlined } from 'components/Button'
import CopyHelper from 'components/Copy'
Expand All @@ -20,6 +21,12 @@ import { formatDisplayNumber } from 'utils/numbers'
import { ContentChangable, TabItem } from './styles'
import useFilter from './useFilter'

const Disclaimer = styled.div`
font-size: 12px;
font-style: italic;
margin-top: 1rem;
`

// () => setShowTokenId(null)
export default function DetailModal({
tokenToShow,
Expand Down Expand Up @@ -296,6 +303,7 @@ export default function DetailModal({
</Box>
)
})}
<Disclaimer>Grouping selection across chains is sourced from Coingecko and CoinMarketCap</Disclaimer>
</Flex>
) : null}
</Modal>
Expand Down Expand Up @@ -332,7 +340,12 @@ export const PriceChange = ({ priceChange }: { priceChange: number | undefined }
animate={!!lastPriceChange && animate}
up={!!lastPriceChange && !!priceChange && priceChange - lastPriceChange >= 0}
>
{!priceChange ? '--' : formatDisplayNumber(priceChange, { style: 'decimal', fractionDigits: 2 }) + '%'}
{!priceChange
? '--'
: `${priceChange < 0 ? '-' : ''}${formatDisplayNumber(Math.abs(priceChange), {
style: 'decimal',
fractionDigits: 2,
})}%`}
</ContentChangable>
)
}

0 comments on commit e7cd115

Please sign in to comment.