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

fix: landing page styling of widget (#5917)

parent 967a6981
...@@ -6,6 +6,7 @@ import Card, { CardType } from 'components/About/Card' ...@@ -6,6 +6,7 @@ import Card, { CardType } from 'components/About/Card'
import { MAIN_CARDS, MORE_CARDS } from 'components/About/constants' import { MAIN_CARDS, MORE_CARDS } from 'components/About/constants'
import ProtocolBanner from 'components/About/ProtocolBanner' import ProtocolBanner from 'components/About/ProtocolBanner'
import { BaseButton } from 'components/Button' import { BaseButton } from 'components/Button'
import { useSwapWidgetEnabled } from 'featureFlags/flags/swapWidget'
import Swap from 'pages/Swap' import Swap from 'pages/Swap'
import { parse } from 'qs' import { parse } from 'qs'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
...@@ -14,7 +15,7 @@ import { useLocation, useNavigate } from 'react-router-dom' ...@@ -14,7 +15,7 @@ import { useLocation, useNavigate } from 'react-router-dom'
import { Link as NativeLink } from 'react-router-dom' import { Link as NativeLink } from 'react-router-dom'
import { useAppSelector } from 'state/hooks' import { useAppSelector } from 'state/hooks'
import { useIsDarkMode } from 'state/user/hooks' import { useIsDarkMode } from 'state/user/hooks'
import styled from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { BREAKPOINTS } from 'theme' import { BREAKPOINTS } from 'theme'
import { Z_INDEX } from 'theme/zIndex' import { Z_INDEX } from 'theme/zIndex'
...@@ -255,25 +256,42 @@ const LandingSwapContainer = styled.div` ...@@ -255,25 +256,42 @@ const LandingSwapContainer = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
z-index: 1;
` `
const LandingSwap = styled(Swap)` const SwapCss = css`
* { * {
pointer-events: none; pointer-events: none;
} }
&:hover { &:hover {
border: 1px solid ${({ theme }) => theme.accentAction};
transform: translateY(-4px); transform: translateY(-4px);
transition: ${({ theme }) => `transform ${theme.transition.duration.medium} ${theme.transition.timing.ease}`};
} }
` `
const Link = styled(NativeLink)` const LinkCss = css`
text-decoration: none; text-decoration: none;
max-width: 480px; max-width: 480px;
width: 100%; width: 100%;
` `
const LandingSwap = styled(Swap)`
${SwapCss}
&:hover {
border: 1px solid ${({ theme }) => theme.accentAction};
}
`
const Link = styled(NativeLink)`
${LinkCss}
`
const WidgetLandingLink = styled(NativeLink)`
${LinkCss}
${SwapCss}
`
export default function Landing() { export default function Landing() {
const isDarkMode = useIsDarkMode() const isDarkMode = useIsDarkMode()
...@@ -287,6 +305,8 @@ export default function Landing() { ...@@ -287,6 +305,8 @@ export default function Landing() {
ignoreQueryPrefix: true, ignoreQueryPrefix: true,
}) })
const swapWidgetEnabled = useSwapWidgetEnabled()
// This can be simplified significantly once the flag is removed! For now being explicit is clearer. // This can be simplified significantly once the flag is removed! For now being explicit is clearer.
useEffect(() => { useEffect(() => {
if (queryParams.intro || !selectedWallet) { if (queryParams.intro || !selectedWallet) {
...@@ -306,9 +326,15 @@ export default function Landing() { ...@@ -306,9 +326,15 @@ export default function Landing() {
name={SharedEventName.ELEMENT_CLICKED} name={SharedEventName.ELEMENT_CLICKED}
element={InterfaceElementName.LANDING_PAGE_SWAP_ELEMENT} element={InterfaceElementName.LANDING_PAGE_SWAP_ELEMENT}
> >
<Link to="/swap"> {swapWidgetEnabled ? (
<LandingSwap /> <WidgetLandingLink to="/swap">
</Link> <Swap />
</WidgetLandingLink>
) : (
<Link to="/swap">
<LandingSwap />
</Link>
)}
</TraceEvent> </TraceEvent>
</LandingSwapContainer> </LandingSwapContainer>
<Gradient isDarkMode={isDarkMode} /> <Gradient isDarkMode={isDarkMode} />
......
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