Commit 89290c5b authored by Kenny Tran's avatar Kenny Tran Committed by Chi Kei Chan

Middle arrow flips input/output for swap/send (#151)

parent d63a73ae
...@@ -101,6 +101,17 @@ class Send extends Component { ...@@ -101,6 +101,17 @@ class Send extends Component {
}; };
} }
flipInputOutput = () => {
const { state } = this;
this.setState({
inputValue: state.outputValue,
outputValue: state.inputValue,
inputCurrency: state.outputCurrency,
outputCurrency: state.inputCurrency,
lastEditedField: state.lastEditedField === INPUT ? OUTPUT : INPUT
}, () => this.recalcForm());
}
isUnapproved() { isUnapproved() {
const { account, exchangeAddresses, selectors } = this.props; const { account, exchangeAddresses, selectors } = this.props;
const { inputCurrency, inputValue } = this.state; const { inputCurrency, inputValue } = this.state;
...@@ -734,7 +745,7 @@ class Send extends Component { ...@@ -734,7 +745,7 @@ class Send extends Component {
/> />
<OversizedPanel> <OversizedPanel>
<div className="swap__down-arrow-background"> <div className="swap__down-arrow-background">
<img className="swap__down-arrow" src={isValid ? ArrowDownBlue : ArrowDownGrey} /> <img onClick={this.flipInputOutput} className="swap__down-arrow swap__down-arrow--clickable" src={isValid ? ArrowDownBlue : ArrowDownGrey} />
</div> </div>
</OversizedPanel> </OversizedPanel>
<CurrencyInputPanel <CurrencyInputPanel
......
...@@ -98,6 +98,17 @@ class Swap extends Component { ...@@ -98,6 +98,17 @@ class Swap extends Component {
}; };
} }
flipInputOutput = () => {
const { state } = this;
this.setState({
inputValue: state.outputValue,
outputValue: state.inputValue,
inputCurrency: state.outputCurrency,
outputCurrency: state.inputCurrency,
lastEditedField: state.lastEditedField === INPUT ? OUTPUT : INPUT
}, () => this.recalcForm());
}
isUnapproved() { isUnapproved() {
const { account, exchangeAddresses, selectors } = this.props; const { account, exchangeAddresses, selectors } = this.props;
const { inputCurrency, inputValue } = this.state; const { inputCurrency, inputValue } = this.state;
...@@ -716,7 +727,7 @@ class Swap extends Component { ...@@ -716,7 +727,7 @@ class Swap extends Component {
/> />
<OversizedPanel> <OversizedPanel>
<div className="swap__down-arrow-background"> <div className="swap__down-arrow-background">
<img className="swap__down-arrow" src={isValid ? ArrowDownBlue : ArrowDownGrey} /> <img onClick={this.flipInputOutput} className="swap__down-arrow swap__down-arrow--clickable" src={isValid ? ArrowDownBlue : ArrowDownGrey} />
</div> </div>
</OversizedPanel> </OversizedPanel>
<CurrencyInputPanel <CurrencyInputPanel
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
position: relative; position: relative;
z-index: 200; z-index: 200;
padding: .875rem; padding: .875rem;
&--clickable {
cursor: pointer;
}
} }
&__down-arrow-background { &__down-arrow-background {
......
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