-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: font-weight updates * Toolbar icon sizing and text alignment * undo font-weight increase * feat: down arrow instead of double arrow reverse * toolbar caption text should be color=secondary unless rendering an exchange rate * update placeholder disabled color * pr feedback
- Loading branch information
1 parent
6e8b05c
commit 2222ddf
Showing
4 changed files
with
25 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,39 @@ | ||
import { useSwapInfo, useSwitchSwapCurrencies } from 'hooks/swap' | ||
import { ArrowDown as ArrowDownIcon, ArrowUp as ArrowUpIcon } from 'icons' | ||
import { useCallback, useState } from 'react' | ||
import { ArrowDown } from 'icons' | ||
import { transparentize } from 'polished' | ||
import styled from 'styled-components/macro' | ||
import { Layer } from 'theme' | ||
|
||
import Button from '../Button' | ||
import Row from '../Row' | ||
|
||
const ReverseRow = styled(Row)` | ||
const StyledReverseButton = styled(Button)` | ||
align-items: center; | ||
background-color: ${({ theme }) => theme.module}; | ||
border: 4px solid; | ||
border-color: ${({ theme }) => theme.container}; | ||
border-radius: ${({ theme }) => theme.borderRadius * 0.75}em; | ||
display: flex; | ||
height: 40px; | ||
justify-content: center; | ||
left: 50%; | ||
position: absolute; | ||
transform: translate(-50%, -60%); | ||
transition: 125ms ease background-color; | ||
width: 40px; | ||
z-index: ${Layer.OVERLAY}; | ||
` | ||
|
||
const ArrowUp = styled(ArrowUpIcon)` | ||
left: calc(50% - 0.37em); | ||
position: absolute; | ||
top: calc(50% - 0.82em); | ||
` | ||
|
||
const ArrowDown = styled(ArrowDownIcon)` | ||
bottom: calc(50% - 0.82em); | ||
position: absolute; | ||
right: calc(50% - 0.37em); | ||
` | ||
|
||
const Overlay = styled.div` | ||
background-color: ${({ theme }) => theme.container}; | ||
border-radius: ${({ theme }) => theme.borderRadius}em; | ||
padding: 0.25em; | ||
` | ||
|
||
const StyledReverseButton = styled(Button)<{ turns: number }>` | ||
border-radius: ${({ theme }) => theme.borderRadius * 0.75}em; | ||
color: ${({ theme }) => theme.primary}; | ||
height: 2.5em; | ||
position: relative; | ||
width: 2.5em; | ||
div { | ||
transform: rotate(${({ turns }) => turns / 2}turn); | ||
transition: transform 0.25s ease-in-out; | ||
will-change: transform; | ||
:hover { | ||
background-color: ${({ theme }) => transparentize(0.2, theme.module)}; | ||
} | ||
` | ||
|
||
export default function ReverseButton() { | ||
const { error } = useSwapInfo() | ||
const isDisabled = error !== undefined | ||
|
||
const switchCurrencies = useSwitchSwapCurrencies() | ||
const [turns, setTurns] = useState(0) | ||
const onClick = useCallback(() => { | ||
switchCurrencies() | ||
setTurns((turns) => ++turns) | ||
}, [switchCurrencies]) | ||
|
||
return ( | ||
<ReverseRow justify="center"> | ||
<Overlay> | ||
<StyledReverseButton disabled={isDisabled} onClick={onClick} turns={turns}> | ||
<div> | ||
<ArrowUp strokeWidth={3} /> | ||
<ArrowDown strokeWidth={3} /> | ||
</div> | ||
</StyledReverseButton> | ||
</Overlay> | ||
</ReverseRow> | ||
<StyledReverseButton disabled={isDisabled} onClick={switchCurrencies}> | ||
<ArrowDown /> | ||
</StyledReverseButton> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2222ddf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
widgets – ./
widgets-seven-tau.vercel.app
widgets-uniswap.vercel.app
widgets-git-main-uniswap.vercel.app