Commit 27094c87 authored by Moody Salem's avatar Moody Salem

clean up price impact formatting

parent bede9171
import { Percent } from '@uniswap/sdk-core'
import React from 'react'
import { ONE_BIPS } from '../../constants'
import { warningSeverity } from '../../utils/prices'
import { ErrorText, ErrorPill } from './styleds'
......@@ -10,11 +9,7 @@ import { ErrorText, ErrorPill } from './styleds'
export default function FormattedPriceImpact({ priceImpact }: { priceImpact?: Percent }) {
return (
<ErrorText fontWeight={500} fontSize={12} severity={warningSeverity(priceImpact)}>
{priceImpact
? priceImpact.lessThan(ONE_BIPS)
? `-${priceImpact.toFixed(2)}%`
: `${priceImpact.toFixed(2)}%`
: '-'}
{priceImpact ? `-${priceImpact.toFixed(2)}%` : '-'}
</ErrorText>
)
}
......@@ -22,11 +17,7 @@ export default function FormattedPriceImpact({ priceImpact }: { priceImpact?: Pe
export function SmallFormattedPriceImpact({ priceImpact }: { priceImpact?: Percent }) {
return (
<ErrorPill fontWeight={500} fontSize={12} severity={warningSeverity(priceImpact)}>
{priceImpact
? priceImpact.lessThan(ONE_BIPS)
? `(-${priceImpact.toFixed(2)}%)`
: `(-${priceImpact.toFixed(2)}%)`
: '-'}
{priceImpact ? `(-${priceImpact.toFixed(2)}%)` : '-'}
</ErrorPill>
)
}
......@@ -55,7 +55,7 @@ export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>`
? theme.yellow2
: severity === 1
? theme.text1
: theme.green1};
: theme.text2};
`
export const ErrorPill = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment