Commit a73e8141 authored by vignesh mohankumar's avatar vignesh mohankumar Committed by GitHub

fix: swap hover states (#4771)

* Swap component tweaks

* Fix spacing issues and update swap arrows icon

* px

* fix ternaries

* 20px

* create a separate OutputWrapper

* variable

* update border radius case

* fix type

* use right variable

* move the containers around

* rename to swap section

* swapdetailssection

* remove unnecessary autocolumn

* border radius

* remove unnecessary wrapping div

* wrap the output swap stuff

* inherit border-radius

* update overlay styles

* remove floating bg

* fix ungated version

* fix background colors

* trying this out

* separate blocks

* accent action on the buttons

* undo

* show unselected state properly

* show on expert mode

* 0 not none

* handle margintop

* flag font size

* undo reverse icon change

* fix build
Co-authored-by: default avatarCallil Capuozzo <callil.capuozzo@gmail.com>
parent 7125562c
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.80333 4.8863C7.51044 5.17919 7.51044 5.65406 7.80333 5.94696C8.09622 6.23985 8.5711 6.23985 8.86399 5.94696L7.80333 4.8863ZM12.0837 1.66663L12.614 1.1363C12.3211 0.843403 11.8462 0.843403 11.5533 1.1363L12.0837 1.66663ZM15.3033 5.94696C15.5962 6.23985 16.0711 6.23985 16.364 5.94696C16.6569 5.65406 16.6569 5.17919 16.364 4.8863L15.3033 5.94696ZM11.3337 9.99996C11.3337 10.4142 11.6694 10.75 12.0837 10.75C12.4979 10.75 12.8337 10.4142 12.8337 9.99996H11.3337ZM12.1973 15.1136C12.4902 14.8207 12.4902 14.3459 12.1973 14.053C11.9044 13.7601 11.4296 13.7601 11.1367 14.053L12.1973 15.1136ZM7.91699 18.3333L7.38666 18.8636C7.52731 19.0043 7.71808 19.0833 7.91699 19.0833C8.1159 19.0833 8.30667 19.0043 8.44732 18.8636L7.91699 18.3333ZM4.69732 14.053C4.40443 13.7601 3.92956 13.7601 3.63666 14.053C3.34377 14.3459 3.34377 14.8207 3.63666 15.1136L4.69732 14.053ZM8.66699 10.8333C8.66699 10.4191 8.33121 10.0833 7.91699 10.0833C7.50278 10.0833 7.16699 10.4191 7.16699 10.8333H8.66699ZM8.86399 5.94696L12.614 2.19696L11.5533 1.1363L7.80333 4.8863L8.86399 5.94696ZM11.5533 2.19696L15.3033 5.94696L16.364 4.8863L12.614 1.1363L11.5533 2.19696ZM11.3337 1.66663V9.99996H12.8337V1.66663H11.3337ZM11.1367 14.053L7.38666 17.803L8.44732 18.8636L12.1973 15.1136L11.1367 14.053ZM8.44732 17.803L4.69732 14.053L3.63666 15.1136L7.38666 18.8636L8.44732 17.803ZM8.66699 18.3333L8.66699 10.8333H7.16699L7.16699 18.3333H8.66699Z" fill="currentColor"/>
</svg>
...@@ -11,7 +11,7 @@ import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign' ...@@ -11,7 +11,7 @@ import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign'
import { darken } from 'polished' import { darken } from 'polished'
import { ReactNode, useCallback, useState } from 'react' import { ReactNode, useCallback, useState } from 'react'
import { Lock } from 'react-feather' import { Lock } from 'react-feather'
import styled, { useTheme } from 'styled-components/macro' import styled, { css, useTheme } from 'styled-components/macro'
import { formatCurrencyAmount } from 'utils/formatCurrencyAmount' import { formatCurrencyAmount } from 'utils/formatCurrencyAmount'
import { ReactComponent as DropDown } from '../../assets/images/dropdown.svg' import { ReactComponent as DropDown } from '../../assets/images/dropdown.svg'
...@@ -50,7 +50,7 @@ const FixedContainer = styled.div<{ redesignFlag: boolean }>` ...@@ -50,7 +50,7 @@ const FixedContainer = styled.div<{ redesignFlag: boolean }>`
` `
const Container = styled.div<{ hideInput: boolean; disabled: boolean; redesignFlag: boolean }>` const Container = styled.div<{ hideInput: boolean; disabled: boolean; redesignFlag: boolean }>`
min-height: ${({ redesignFlag }) => redesignFlag && '69px'}; min-height: ${({ redesignFlag }) => redesignFlag && '44px'};
border-radius: ${({ hideInput }) => (hideInput ? '16px' : '20px')}; border-radius: ${({ hideInput }) => (hideInput ? '16px' : '20px')};
border: 1px solid ${({ theme, redesignFlag }) => (redesignFlag ? 'transparent' : theme.deprecated_bg0)}; border: 1px solid ${({ theme, redesignFlag }) => (redesignFlag ? 'transparent' : theme.deprecated_bg0)};
background-color: ${({ theme, redesignFlag }) => (redesignFlag ? 'transparent' : theme.deprecated_bg1)}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? 'transparent' : theme.deprecated_bg1)};
...@@ -77,7 +77,7 @@ const CurrencySelect = styled(ButtonGray)<{ ...@@ -77,7 +77,7 @@ const CurrencySelect = styled(ButtonGray)<{
background-color: ${({ selected, theme, redesignFlag }) => background-color: ${({ selected, theme, redesignFlag }) =>
redesignFlag redesignFlag
? selected ? selected
? theme.stateOverlayPressed ? theme.backgroundInteractive
: theme.accentAction : theme.accentAction
: selected : selected
? theme.deprecated_bg2 ? theme.deprecated_bg2
...@@ -100,23 +100,47 @@ const CurrencySelect = styled(ButtonGray)<{ ...@@ -100,23 +100,47 @@ const CurrencySelect = styled(ButtonGray)<{
justify-content: space-between; justify-content: space-between;
margin-left: ${({ hideInput }) => (hideInput ? '0' : '12px')}; margin-left: ${({ hideInput }) => (hideInput ? '0' : '12px')};
&:hover { ${({ redesignFlag, selected }) =>
background-color: ${({ selected, theme, redesignFlag }) => !redesignFlag &&
redesignFlag css`
? theme.stateOverlayHover &:hover {
: selected background-color: ${({ theme }) => (selected ? darken(0.05, theme.deprecated_primary1) : theme.deprecated_bg3)};
? darken(0.05, theme.deprecated_primary1) }
: theme.deprecated_bg3};
}
&:active { &:active {
background-color: ${({ selected, theme, redesignFlag }) => background-color: ${({ theme }) => (selected ? darken(0.05, theme.deprecated_primary1) : theme.deprecated_bg3)};
redesignFlag }
? theme.stateOverlayPressed `}
: selected
? darken(0.05, theme.deprecated_primary1) ${({ redesignFlag, selected }) =>
: theme.deprecated_bg3}; redesignFlag &&
} css`
&:hover,
&:active {
background-color: ${({ theme }) => (selected ? theme.backgroundInteractive : theme.accentAction)};
}
&:before {
background-size: 100%;
border-radius: inherit;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
content: '';
}
&:hover:before {
background-color: ${({ theme }) => theme.stateOverlayHover};
}
&:active:before {
background-color: ${({ theme }) => theme.stateOverlayPressed};
}
`}
visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')}; visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')};
` `
...@@ -135,7 +159,7 @@ const LabelRow = styled.div<{ redesignFlag: boolean }>` ...@@ -135,7 +159,7 @@ const LabelRow = styled.div<{ redesignFlag: boolean }>`
color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.textSecondary : theme.deprecated_text1)}; color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.textSecondary : theme.deprecated_text1)};
font-size: 0.75rem; font-size: 0.75rem;
line-height: 1rem; line-height: 1rem;
padding: 0 1rem 1rem; padding: ${({ redesignFlag }) => (redesignFlag ? '0px' : '0 1rem 1rem')};
span:hover { span:hover {
cursor: pointer; cursor: pointer;
...@@ -145,8 +169,8 @@ const LabelRow = styled.div<{ redesignFlag: boolean }>` ...@@ -145,8 +169,8 @@ const LabelRow = styled.div<{ redesignFlag: boolean }>`
const FiatRow = styled(LabelRow)<{ redesignFlag: boolean }>` const FiatRow = styled(LabelRow)<{ redesignFlag: boolean }>`
justify-content: flex-end; justify-content: flex-end;
min-height: ${({ redesignFlag }) => redesignFlag && '32px'}; min-height: ${({ redesignFlag }) => redesignFlag && '20px'};
padding: ${({ redesignFlag }) => redesignFlag && '8px 0px'}; padding: ${({ redesignFlag }) => redesignFlag && '8px 0px 0px 0px'};
height: ${({ redesignFlag }) => !redesignFlag && '24px'}; height: ${({ redesignFlag }) => !redesignFlag && '24px'};
` `
...@@ -170,7 +194,7 @@ const StyledDropDown = styled(DropDown)<{ selected: boolean; redesignFlag: boole ...@@ -170,7 +194,7 @@ const StyledDropDown = styled(DropDown)<{ selected: boolean; redesignFlag: boole
const StyledTokenName = styled.span<{ active?: boolean; redesignFlag: boolean }>` const StyledTokenName = styled.span<{ active?: boolean; redesignFlag: boolean }>`
${({ active }) => (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;')} ${({ active }) => (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;')}
font-size: ${({ active }) => (active ? '18px' : '18px')}; font-size: ${({ redesignFlag }) => (redesignFlag ? '20px' : '18px')};
font-weight: ${({ redesignFlag }) => (redesignFlag ? '600' : '500')}; font-weight: ${({ redesignFlag }) => (redesignFlag ? '600' : '500')};
` `
......
...@@ -140,7 +140,7 @@ const StyledDropDown = styled(DropDown)<{ selected: boolean }>` ...@@ -140,7 +140,7 @@ const StyledDropDown = styled(DropDown)<{ selected: boolean }>`
const StyledTokenName = styled.span<{ active?: boolean }>` const StyledTokenName = styled.span<{ active?: boolean }>`
${({ active }) => (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;')} ${({ active }) => (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;')}
font-size: ${({ active }) => (active ? '18px' : '18px')}; font-size: 20px;
` `
const StyledBalanceMax = styled.button<{ disabled?: boolean }>` const StyledBalanceMax = styled.button<{ disabled?: boolean }>`
......
...@@ -23,9 +23,13 @@ import { ResponsiveTooltipContainer } from './styleds' ...@@ -23,9 +23,13 @@ import { ResponsiveTooltipContainer } from './styleds'
import SwapRoute from './SwapRoute' import SwapRoute from './SwapRoute'
import TradePrice from './TradePrice' import TradePrice from './TradePrice'
const Wrapper = styled(Row)` const Wrapper = styled(Row)<{ redesignFlag: boolean }>`
width: 100%; width: 100%;
justify-content: center; justify-content: center;
border-radius: ${({ redesignFlag }) => redesignFlag && 'inherit'};
padding: ${({ redesignFlag }) => redesignFlag && '8px 12px'};
margin-top: ${({ redesignFlag }) => (redesignFlag ? '0px' : '4px')} !important;
min-height: ${({ redesignFlag }) => redesignFlag && '32px'};
` `
const StyledInfoIcon = styled(Info)` const StyledInfoIcon = styled(Info)`
...@@ -41,14 +45,11 @@ const StyledCard = styled(OutlineCard)<{ redesignFlag: boolean }>` ...@@ -41,14 +45,11 @@ const StyledCard = styled(OutlineCard)<{ redesignFlag: boolean }>`
` `
const StyledHeaderRow = styled(RowBetween)<{ disabled: boolean; open: boolean; redesignFlag: boolean }>` const StyledHeaderRow = styled(RowBetween)<{ disabled: boolean; open: boolean; redesignFlag: boolean }>`
padding: ${({ redesignFlag }) => (redesignFlag ? '8px 0px 0px 0px' : '4px 8px')}; padding: ${({ redesignFlag }) => (redesignFlag ? '0' : '4px 8px')};
background-color: ${({ open, theme, redesignFlag }) => background-color: ${({ open, theme, redesignFlag }) =>
open && !redesignFlag ? theme.deprecated_bg1 : 'transparent'}; open && !redesignFlag ? theme.deprecated_bg1 : 'transparent'};
align-items: center; align-items: center;
border-top: 1px solid ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundOutline : 'transparent')};
margin-top: ${({ redesignFlag }) => redesignFlag && '8px'};
cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')}; cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};
min-height: 40px;
border-radius: ${({ redesignFlag }) => !redesignFlag && '12px'}; border-radius: ${({ redesignFlag }) => !redesignFlag && '12px'};
` `
...@@ -133,7 +134,7 @@ export default function SwapDetailsDropdown({ ...@@ -133,7 +134,7 @@ export default function SwapDetailsDropdown({
const redesignFlagEnabled = redesignFlag === RedesignVariant.Enabled const redesignFlagEnabled = redesignFlag === RedesignVariant.Enabled
return ( return (
<Wrapper style={{ marginTop: '8px' }}> <Wrapper style={{ marginTop: redesignFlagEnabled ? '0' : '8px' }} redesignFlag={redesignFlagEnabled}>
<AutoColumn gap={'8px'} style={{ width: '100%', marginBottom: '-8px' }}> <AutoColumn gap={'8px'} style={{ width: '100%', marginBottom: '-8px' }}>
<TraceEvent <TraceEvent
events={[Event.onClick]} events={[Event.onClick]}
......
...@@ -36,15 +36,14 @@ export const SwapWrapper = styled.main<{ margin?: string; maxWidth?: string; red ...@@ -36,15 +36,14 @@ export const SwapWrapper = styled.main<{ margin?: string; maxWidth?: string; red
` `
export const ArrowWrapper = styled.div<{ clickable: boolean; redesignFlag: boolean }>` export const ArrowWrapper = styled.div<{ clickable: boolean; redesignFlag: boolean }>`
padding: 4px;
border-radius: 12px; border-radius: 12px;
height: ${({ redesignFlag }) => (redesignFlag ? '40px' : '32px')}; height: ${({ redesignFlag }) => (redesignFlag ? '40px' : '32px')};
width: ${({ redesignFlag }) => (redesignFlag ? '40px' : '32px')}; width: ${({ redesignFlag }) => (redesignFlag ? '40px' : '32px')};
position: relative; position: relative;
margin-top: ${({ redesignFlag }) => (redesignFlag ? '-18px' : '-14px')}; margin-top: ${({ redesignFlag }) => (redesignFlag ? '-18px' : '-14px')};
margin-bottom: ${({ redesignFlag }) => (redesignFlag ? '-18px' : '-14px')}; margin-bottom: ${({ redesignFlag }) => (redesignFlag ? '-18px' : '-14px')};
left: calc(50% - 16px); margin-left: auto;
/* transform: rotate(90deg); */ margin-right: auto;
background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundInteractive : theme.deprecated_bg1)}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundInteractive : theme.deprecated_bg1)};
border: 4px solid; border: 4px solid;
border-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundSurface : theme.deprecated_bg0)}; border-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundSurface : theme.deprecated_bg0)};
......
This diff is collapsed.
...@@ -77,6 +77,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors { ...@@ -77,6 +77,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors {
backgroundBackdrop: darkMode ? colorsDark.backgroundBackdrop : colorsLight.backgroundBackdrop, backgroundBackdrop: darkMode ? colorsDark.backgroundBackdrop : colorsLight.backgroundBackdrop,
backgroundSurface: darkMode ? colorsDark.backgroundSurface : colorsLight.backgroundSurface, backgroundSurface: darkMode ? colorsDark.backgroundSurface : colorsLight.backgroundSurface,
backgroundModule: darkMode ? colorsDark.backgroundModule : colorsLight.backgroundModule, backgroundModule: darkMode ? colorsDark.backgroundModule : colorsLight.backgroundModule,
backgroundFloating: darkMode ? colorsDark.backgroundFloating : colorsLight.backgroundFloating,
backgroundInteractive: darkMode ? colorsDark.backgroundInteractive : colorsLight.backgroundInteractive, backgroundInteractive: darkMode ? colorsDark.backgroundInteractive : colorsLight.backgroundInteractive,
backgroundOutline: darkMode ? colorsDark.backgroundOutline : colorsLight.backgroundOutline, backgroundOutline: darkMode ? colorsDark.backgroundOutline : colorsLight.backgroundOutline,
backgroundScrim: darkMode ? colorsDark.backgroundScrim : colorsLight.backgroundScrim, backgroundScrim: darkMode ? colorsDark.backgroundScrim : colorsLight.backgroundScrim,
......
...@@ -9,6 +9,7 @@ export interface ThemeColors { ...@@ -9,6 +9,7 @@ export interface ThemeColors {
backgroundBackdrop: Color backgroundBackdrop: Color
backgroundSurface: Color backgroundSurface: Color
backgroundModule: Color backgroundModule: Color
backgroundFloating: Color
backgroundInteractive: Color backgroundInteractive: Color
backgroundOutline: Color backgroundOutline: Color
backgroundScrim: Color backgroundScrim: Color
......
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