Commit c098ad1f authored by eddie's avatar eddie Committed by GitHub

fix: correct font size for the trade rate to on safari (#5714)

* fix: correct font size for the trade rate to on safari

* fix: use themedText.BodySmall for this label
parent 4529e3cc
...@@ -110,19 +110,10 @@ interface SwapDetailsInlineProps { ...@@ -110,19 +110,10 @@ interface SwapDetailsInlineProps {
trade: InterfaceTrade<Currency, Currency, TradeType> | undefined trade: InterfaceTrade<Currency, Currency, TradeType> | undefined
syncing: boolean syncing: boolean
loading: boolean loading: boolean
showInverted: boolean
setShowInverted: React.Dispatch<React.SetStateAction<boolean>>
allowedSlippage: Percent allowedSlippage: Percent
} }
export default function SwapDetailsDropdown({ export default function SwapDetailsDropdown({ trade, syncing, loading, allowedSlippage }: SwapDetailsInlineProps) {
trade,
syncing,
loading,
showInverted,
setShowInverted,
allowedSlippage,
}: SwapDetailsInlineProps) {
const theme = useTheme() const theme = useTheme()
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const [showDetails, setShowDetails] = useState(false) const [showDetails, setShowDetails] = useState(false)
...@@ -169,11 +160,7 @@ export default function SwapDetailsDropdown({ ...@@ -169,11 +160,7 @@ export default function SwapDetailsDropdown({
)} )}
{trade ? ( {trade ? (
<LoadingOpacityContainer $loading={syncing}> <LoadingOpacityContainer $loading={syncing}>
<TradePrice <TradePrice price={trade.executionPrice} />
price={trade.executionPrice}
showInverted={showInverted}
setShowInverted={setShowInverted}
/>
</LoadingOpacityContainer> </LoadingOpacityContainer>
) : loading || syncing ? ( ) : loading || syncing ? (
<ThemedText.DeprecatedMain fontSize={14}> <ThemedText.DeprecatedMain fontSize={14}>
......
...@@ -75,7 +75,6 @@ export default function SwapModalHeader({ ...@@ -75,7 +75,6 @@ export default function SwapModalHeader({
}) { }) {
const theme = useTheme() const theme = useTheme()
const [showInverted, setShowInverted] = useState<boolean>(false)
const [lastExecutionPrice, setLastExecutionPrice] = useState(trade.executionPrice) const [lastExecutionPrice, setLastExecutionPrice] = useState(trade.executionPrice)
const [priceUpdate, setPriceUpdate] = useState<number | undefined>() const [priceUpdate, setPriceUpdate] = useState<number | undefined>()
...@@ -153,7 +152,7 @@ export default function SwapModalHeader({ ...@@ -153,7 +152,7 @@ export default function SwapModalHeader({
</AutoColumn> </AutoColumn>
</LightCard> </LightCard>
<RowBetween style={{ marginTop: '0.25rem', padding: '0 1rem' }}> <RowBetween style={{ marginTop: '0.25rem', padding: '0 1rem' }}>
<TradePrice price={trade.executionPrice} showInverted={showInverted} setShowInverted={setShowInverted} /> <TradePrice price={trade.executionPrice} />
</RowBetween> </RowBetween>
<LightCard style={{ padding: '.75rem', marginTop: '0.5rem' }}> <LightCard style={{ padding: '.75rem', marginTop: '0.5rem' }}>
<AdvancedSwapDetails trade={trade} allowedSlippage={allowedSlippage} /> <AdvancedSwapDetails trade={trade} allowedSlippage={allowedSlippage} />
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, Price } from '@uniswap/sdk-core' import { Currency, Price } from '@uniswap/sdk-core'
import useStablecoinPrice from 'hooks/useStablecoinPrice' import useStablecoinPrice from 'hooks/useStablecoinPrice'
import { useCallback } from 'react' import { useCallback, useState } from 'react'
import { Text } from 'rebass' import styled from 'styled-components/macro'
import styled, { useTheme } from 'styled-components/macro'
import { ThemedText } from 'theme' import { ThemedText } from 'theme'
import { formatDollar, formatTransactionAmount, priceToPreciseFloat } from 'utils/formatNumbers' import { formatDollar, formatTransactionAmount, priceToPreciseFloat } from 'utils/formatNumbers'
interface TradePriceProps { interface TradePriceProps {
price: Price<Currency, Currency> price: Price<Currency, Currency>
showInverted: boolean
setShowInverted: (showInverted: boolean) => void
} }
const StyledPriceContainer = styled.button` const StyledPriceContainer = styled.button`
...@@ -30,8 +27,8 @@ const StyledPriceContainer = styled.button` ...@@ -30,8 +27,8 @@ const StyledPriceContainer = styled.button`
user-select: text; user-select: text;
` `
export default function TradePrice({ price, showInverted, setShowInverted }: TradePriceProps) { export default function TradePrice({ price }: TradePriceProps) {
const theme = useTheme() const [showInverted, setShowInverted] = useState<boolean>(false)
const usdcPrice = useStablecoinPrice(showInverted ? price.baseCurrency : price.quoteCurrency) const usdcPrice = useStablecoinPrice(showInverted ? price.baseCurrency : price.quoteCurrency)
...@@ -58,9 +55,7 @@ export default function TradePrice({ price, showInverted, setShowInverted }: Tra ...@@ -58,9 +55,7 @@ export default function TradePrice({ price, showInverted, setShowInverted }: Tra
}} }}
title={text} title={text}
> >
<Text fontWeight={500} color={theme.textPrimary}> <ThemedText.BodySmall>{text}</ThemedText.BodySmall>{' '}
{text}
</Text>{' '}
{usdcPrice && ( {usdcPrice && (
<ThemedText.DeprecatedDarkGray> <ThemedText.DeprecatedDarkGray>
<Trans>({formatDollar({ num: priceToPreciseFloat(usdcPrice), isPrice: true })})</Trans> <Trans>({formatDollar({ num: priceToPreciseFloat(usdcPrice), isPrice: true })})</Trans>
......
...@@ -441,7 +441,6 @@ export default function Swap({ className }: { className?: string }) { ...@@ -441,7 +441,6 @@ export default function Swap({ className }: { className?: string }) {
]) ])
// errors // errors
const [showInverted, setShowInverted] = useState<boolean>(false)
const [swapQuoteReceivedDate, setSwapQuoteReceivedDate] = useState<Date | undefined>() const [swapQuoteReceivedDate, setSwapQuoteReceivedDate] = useState<Date | undefined>()
// warnings on the greater of fiat value price impact and execution price impact // warnings on the greater of fiat value price impact and execution price impact
...@@ -663,8 +662,6 @@ export default function Swap({ className }: { className?: string }) { ...@@ -663,8 +662,6 @@ export default function Swap({ className }: { className?: string }) {
trade={trade} trade={trade}
syncing={routeIsSyncing} syncing={routeIsSyncing}
loading={routeIsLoading} loading={routeIsLoading}
showInverted={showInverted}
setShowInverted={setShowInverted}
allowedSlippage={allowedSlippage} allowedSlippage={allowedSlippage}
/> />
</DetailsSwapSection> </DetailsSwapSection>
......
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