Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
feat: add assets switcher (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Feb 15, 2019
1 parent ac8f3b0 commit a6c9597
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/components/dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ class DropDown extends React.Component {
value: undefined,
};

componentWillReceiveProps(nextProps) {
const { defaultValue } = nextProps;

if (defaultValue !== this.state.value) {
this.setState({
value: defaultValue,
});
}
}

render() {
let { value } = this.state;
const { classes, onChange, defaultValue, fields } = this.props;
Expand Down
29 changes: 27 additions & 2 deletions src/components/swaptab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import React from 'react';
import PropTypes from 'prop-types';
import injectSheet from 'react-jss';
import { BigNumber } from 'bignumber.js';
import { MdCompareArrows } from 'react-icons/md';
import View from '../view';
import Input from '../input';
import DropDown from '../dropdown';
import Text, { InfoText } from '../text';
import { MIN, MAX } from '../../constants/fees';
import Controls from '../controls';
import Text, { InfoText } from '../text';
import { decimals } from '../../scripts/utils';
import { MIN, MAX } from '../../constants/fees';

const styles = theme => ({
wrapper: {
Expand Down Expand Up @@ -77,6 +78,19 @@ const styles = theme => ({
text: {
fontSize: '20px',
},
arrows: {
height: '30px',
width: '30px',
marginLeft: '80%',
cursor: 'pointer',
transform: 'rotate(90deg)',
transition: 'none 200ms ease-out',
transitionProperty: 'color',
color: theme.colors.tundoraGrey,
'&:hover': {
color: theme.colors.hoverGrey,
},
},
});

class SwapTab extends React.Component {
Expand Down Expand Up @@ -289,6 +303,17 @@ class SwapTab extends React.Component {
onChange={e => this.updatePair(quote, e)}
/>
</View>
<MdCompareArrows
className={classes.arrows}
onClick={() => {
console.log(base);
console.log(quote);
this.setState({
base: quote,
quote: base,
});
}}
/>
<View className={classes.select}>
<Text text="You receive:" className={classes.text} />
<Input
Expand Down
1 change: 1 addition & 0 deletions src/constants/theme/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const colors = {
lightGrey: '#D3D3D3',
mischkaGrey: '#DDD9DF',
tundoraGrey: '#4A4A4A',
hoverGrey: '#9D9D9D',
white: '#fff',
red: '#FF0000',
};
Expand Down

0 comments on commit a6c9597

Please sign in to comment.