diff --git a/.eslintrc b/.eslintrc index f022f0dd..f64ba51d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,6 +10,7 @@ "rules": { "camelcase": 0, "no-shadow": 0, + "no-void": 0, "new-cap": 0, "no-return-assign": 0, "no-nested-ternary": 0, diff --git a/src/components/AccountPage.js b/src/components/AccountPage.js new file mode 100644 index 00000000..50b14595 --- /dev/null +++ b/src/components/AccountPage.js @@ -0,0 +1,15 @@ +// @flow + +import React, { PureComponent } from 'react' + +import Box from 'components/base/Box' + +type Props = {} + +class AccountPage extends PureComponent { + render() { + return {'account'} + } +} + +export default AccountPage diff --git a/src/components/Home.js b/src/components/DashboardPage.js similarity index 86% rename from src/components/Home.js rename to src/components/DashboardPage.js index 0d37bf87..1544391a 100644 --- a/src/components/Home.js +++ b/src/components/DashboardPage.js @@ -18,7 +18,7 @@ type Props = { currentDevice: Device | null, } -class Home extends PureComponent { +class DashboardPage extends PureComponent { render() { const { currentDevice } = this.props return currentDevice !== null ? ( @@ -29,4 +29,4 @@ class Home extends PureComponent { } } -export default connect(mapStateToProps)(Home) +export default connect(mapStateToProps)(DashboardPage) diff --git a/src/components/SettingsPage.js b/src/components/SettingsPage.js new file mode 100644 index 00000000..7e947b98 --- /dev/null +++ b/src/components/SettingsPage.js @@ -0,0 +1,15 @@ +// @flow + +import React, { PureComponent } from 'react' + +import Box from 'components/base/Box' + +type Props = {} + +class SettingsPage extends PureComponent { + render() { + return {'settings'} + } +} + +export default SettingsPage diff --git a/src/components/SideBar.js b/src/components/SideBar.js deleted file mode 100644 index 2e9c2592..00000000 --- a/src/components/SideBar.js +++ /dev/null @@ -1,17 +0,0 @@ -// @flow - -import React, { PureComponent } from 'react' - -import Box from 'components/base/Box' - -class SideBar extends PureComponent<{}> { - render() { - return ( - - {''} - - ) - } -} - -export default SideBar diff --git a/src/components/SideBar/Item.js b/src/components/SideBar/Item.js new file mode 100644 index 00000000..42bd8ad7 --- /dev/null +++ b/src/components/SideBar/Item.js @@ -0,0 +1,81 @@ +// @flow + +import React from 'react' +import styled from 'styled-components' +import { compose } from 'redux' +import { withRouter } from 'react-router' +import { push } from 'react-router-redux' +import { connect } from 'react-redux' + +import type { Element } from 'react' +import type { Location } from 'react-router' + +import Box from 'components/base/Box' +import Text from 'components/base/Text' + +type Props = { + children: string, + linkTo?: string | null, + desc?: string | null, + icon?: Element<*> | null, + location: Location, + push: Function, +} + +const mapDispatchToProps = { + push, +} + +const Container = styled(Box).attrs({ + horizontal: true, + align: 'center', + color: 'lead', + p: 2, +})` + cursor: pointer; + color: ${p => (p.active ? p.theme.colors.white : '')}; + + &:hover { + background: rgba(255, 255, 255, 0.05); + } +` + +const IconWrapper = styled(Box)` + width: 30px; + height: 30px; + border: 2px solid rgba(255, 255, 255, 0.1); +` + +function Item({ children, desc, icon, linkTo, push, location }: Props) { + const { pathname } = location + return ( + push(linkTo) : void 0} active={pathname === linkTo}> + {icon || null} +
+ + {children} + + {desc && ( + + {desc} + + )} +
+
+ ) +} + +Item.defaultProps = { + icon: null, + desc: null, + linkTo: null, +} + +export default compose( + withRouter, + // connect router here only to make components re-render + // see https://github.com/ReactTraining/react-router/issues/4671 + connect(({ router }) => ({ router }), mapDispatchToProps, null, { + pure: false, + }), +)(Item) diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js new file mode 100644 index 00000000..c9f66310 --- /dev/null +++ b/src/components/SideBar/index.js @@ -0,0 +1,55 @@ +// @flow + +import React, { PureComponent } from 'react' +import styled from 'styled-components' + +import Box, { GrowScroll } from 'components/base/Box' +import Item from './Item' + +const CapsSubtitle = styled(Box).attrs({ + px: 2, + fontSize: 0, + color: 'shark', +})` + text-transform: uppercase; + font-weight: bold; +` + +class SideBar extends PureComponent<{}> { + render() { + return ( + + + + {'Menu'} +
+ {'Dashboard'} + {'Send'} + {'Receive'} + {'Settings'} +
+
+ + {'Accounts'} +
+ + {'Brian Account'} + + + {'Virginie Account'} + + + {'Ledger Account'} + + + {'Nicolas Account'} + +
+
+
+
+ ) + } +} + +export default SideBar diff --git a/src/components/Wrapper.js b/src/components/Wrapper.js index 902fc036..2d108c6d 100644 --- a/src/components/Wrapper.js +++ b/src/components/Wrapper.js @@ -6,7 +6,10 @@ import { translate } from 'react-i18next' import Box from 'components/base/Box' -import Home from 'components/Home' +import DashboardPage from 'components/DashboardPage' +import SettingsPage from 'components/SettingsPage' +import AccountPage from 'components/AccountPage' + import SideBar from 'components/SideBar' import TopBar from 'components/TopBar' @@ -15,7 +18,9 @@ const Wrapper = () => ( - + + + ) diff --git a/src/styles/global.js b/src/styles/global.js index 7c4bb783..fba9bcf4 100644 --- a/src/styles/global.js +++ b/src/styles/global.js @@ -11,6 +11,7 @@ injectGlobal` font: inherit; color: inherit; user-select: none; + cursor: inherit; min-width: 0; } diff --git a/webpack.renderer.js b/webpack.renderer.js index 7343ff5a..2bba9be0 100644 --- a/webpack.renderer.js +++ b/webpack.renderer.js @@ -3,10 +3,16 @@ const webpack = require('webpack') require('./src/globals') module.exports = { + output: { + publicPath: '/', + }, plugins: [ new webpack.DefinePlugin({ __DEV__, __PROD__, }), ], + devServer: { + historyApiFallback: true, + }, }