From b9665b3a3de2a6c7f9a0da3133321811d823e27d Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Sat, 6 Oct 2018 19:30:55 -0700 Subject: [PATCH] Add Send screen and fixed react-router --- .../address-input-panel.scss | 19 +++ src/components/AddressInputPanel/index.js | 42 ++++++ src/components/Web3Status/index.js | 4 + src/index.js | 6 +- src/pages/App.js | 122 +++++++++--------- src/pages/Send/index.js | 71 ++++++++++ src/pages/Send/send.scss | 6 + 7 files changed, 207 insertions(+), 63 deletions(-) create mode 100644 src/components/AddressInputPanel/address-input-panel.scss create mode 100644 src/components/AddressInputPanel/index.js create mode 100644 src/pages/Send/index.js create mode 100644 src/pages/Send/send.scss diff --git a/src/components/AddressInputPanel/address-input-panel.scss b/src/components/AddressInputPanel/address-input-panel.scss new file mode 100644 index 0000000000..722254bef4 --- /dev/null +++ b/src/components/AddressInputPanel/address-input-panel.scss @@ -0,0 +1,19 @@ +@import '../../variables.scss'; + +.address-input-panel { + @extend %col-nowrap; + + &__input { + color: $mine-shaft-gray; + font-size: .9rem; + outline: none; + border: none; + flex: 1 1 auto; + width: 0; + color: $royal-blue; + + &::placeholder { + color: $chalice-gray; + } + } +} diff --git a/src/components/AddressInputPanel/index.js b/src/components/AddressInputPanel/index.js new file mode 100644 index 0000000000..9f830e9c90 --- /dev/null +++ b/src/components/AddressInputPanel/index.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; + +import './address-input-panel.scss'; + +class AddressInputPanel extends Component { + static propTypes = { + title: PropTypes.string, + description: PropTypes.string, + extraText: PropTypes.string, + }; + + render() { + const { + title, + description, + extraText, + } = this.props; + + return ( +
+
+
+
+ Recipient Address +
+
+
+ +
+
+
+ ) + } +} + +export default connect()(AddressInputPanel); diff --git a/src/components/Web3Status/index.js b/src/components/Web3Status/index.js index f378ab5658..7ca1f0ffe1 100644 --- a/src/components/Web3Status/index.js +++ b/src/components/Web3Status/index.js @@ -18,6 +18,10 @@ function Web3Status(props) {
{ + if (!el) { + return; + } + if (!address|| address.length < 42 || !Web3.utils.isHexStrict(address)) { return; } diff --git a/src/index.js b/src/index.js index d753c0dd55..dfb0a0abdb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { BrowserRouter } from 'react-router-dom' +// import { BrowserRouter } from 'react-router-dom' import App from './pages/App'; import { Provider } from 'react-redux'; @@ -12,11 +12,9 @@ import registerServiceWorker from './registerServiceWorker'; // provider is going to need a store object passed into it ReactDOM.render( - - -, document.getElementById('root') + , document.getElementById('root') ); registerServiceWorker(); diff --git a/src/pages/App.js b/src/pages/App.js index b8602dd33c..8efb1fed81 100644 --- a/src/pages/App.js +++ b/src/pages/App.js @@ -1,72 +1,76 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { Switch, Route } from 'react-router-dom'; -import UniHead from '../components/UniHead' -import Header from '../components/Header'; -import ConnectionHelper from '../components/ConnectionHelper' -import Exchange from '../components/Exchange'; -import RateAndFee from '../components/RateAndFee'; -import Purchase from '../components/Purchase'; -import About from '../components/About'; -import Links from '../components/Links'; -import SharePurchase from '../components/SharePurchase'; +import { BrowserRouter, Switch, Route } from 'react-router-dom'; +// import UniHead from '../components/UniHead' +// import Header from '../components/Header'; +// import ConnectionHelper from '../components/ConnectionHelper' +// import Exchange from '../components/Exchange'; +// import RateAndFee from '../components/RateAndFee'; +// import Purchase from '../components/Purchase'; +// import About from '../components/About'; +// import Links from '../components/Links'; +// import SharePurchase from '../components/SharePurchase'; import Swap from './Swap'; +import Send from './Send'; + import './App.scss'; class App extends Component { - renderMain() { - return ( -
- -
- - - - - {/* */} - - - -
- ) - } + // renderMain() { + // return ( + //
+ // + //
+ // + // + // + // + // {/* */} + // + // + // + //
+ // ) + // } render() { return ( - - - - - + + + + + + + ) } } diff --git a/src/pages/Send/index.js b/src/pages/Send/index.js new file mode 100644 index 0000000000..8c973ff3be --- /dev/null +++ b/src/pages/Send/index.js @@ -0,0 +1,71 @@ +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import { withRouter } from 'react-router-dom'; +import PropTypes from 'prop-types'; +import Header from '../../components/Header'; +import NavigationTabs from '../../components/NavigationTabs'; +import CurrencyInputPanel from '../../components/CurrencyInputPanel'; +import AddressInputPanel from '../../components/AddressInputPanel'; +import OversizedPanel from '../../components/OversizedPanel'; +import ArrowDown from '../../assets/images/arrow-down-blue.svg'; + +import "./send.scss"; + +class Send extends Component { + static propTypes = { + // Injected by React Router Dom + push: PropTypes.func.isRequired, + pathname: PropTypes.string.isRequired, + }; + + render() { + return ( +
+
+ +
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ Exchange Rate + 1 ETH = 1283.878 BAT +
+
+
+
You are selling 0.01 ETH
+
You will receive between 12.80 and 12.83 BAT
+
+
+ +
+ ); + } +} + +export default withRouter( + connect( + (state, ownProps) => ({ + push: ownProps.history.push, + pathname: ownProps.location.pathname, + }), + )(Send) +); diff --git a/src/pages/Send/send.scss b/src/pages/Send/send.scss new file mode 100644 index 0000000000..9eea81f7f1 --- /dev/null +++ b/src/pages/Send/send.scss @@ -0,0 +1,6 @@ +@import "../../variables.scss"; + +.send { + @extend %col-nowrap; + height: 100%; +}