fix: position X opt in tooltip on TDP (#7465)

This commit is contained in:
eddie 2023-10-13 10:20:10 -07:00 committed by GitHub
parent 749c9b40ea
commit e9fbf61375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,7 @@ import {
import { formatCommonPropertiesForTrade } from 'lib/utils/analytics' import { formatCommonPropertiesForTrade } from 'lib/utils/analytics'
import { PropsWithChildren, useEffect, useRef, useState } from 'react' import { PropsWithChildren, useEffect, useRef, useState } from 'react'
import { X } from 'react-feather' import { X } from 'react-feather'
import { useLocation } from 'react-router-dom'
import { Text } from 'rebass' import { Text } from 'rebass'
import { useAppDispatch } from 'state/hooks' import { useAppDispatch } from 'state/hooks'
import { RouterPreference } from 'state/routing/types' import { RouterPreference } from 'state/routing/types'
@ -73,6 +74,7 @@ const OptInContents = ({
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const [showYoureIn, setShowYoureIn] = useState(false) const [showYoureIn, setShowYoureIn] = useState(false)
const isVisible = isOnClassic const isVisible = isOnClassic
const location = useLocation()
// adding this as we need to mount and then set shouldAnimate = true after it mounts to avoid a flicker on initial mount // adding this as we need to mount and then set shouldAnimate = true after it mounts to avoid a flicker on initial mount
const [shouldAnimate, setShouldAnimate] = useState(false) const [shouldAnimate, setShouldAnimate] = useState(false)
@ -115,7 +117,7 @@ const OptInContents = ({
const containerRef = useRef<HTMLDivElement>() const containerRef = useRef<HTMLDivElement>()
if (isSmall) { if (isSmall || location.pathname.includes('/tokens/')) {
return ( return (
<SwapOptInSmallContainer ref={containerRef as any} visible={isVisible} shouldAnimate={shouldAnimate}> <SwapOptInSmallContainer ref={containerRef as any} visible={isVisible} shouldAnimate={shouldAnimate}>
<SwapMustache> <SwapMustache>