From 425a0db9853e5e32dc310cf37f4a0e06770c3947 Mon Sep 17 00:00:00 2001 From: apanizo Date: Tue, 4 Sep 2018 17:00:12 +0200 Subject: [PATCH] Moving Popper into Header's Layout and reusing openHoc attrs from there --- src/components/Header/component/Layout.jsx | 29 ++++++++++++++++--- .../Header/component/Layout.stories.js | 25 ++++++++++++---- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/components/Header/component/Layout.jsx b/src/components/Header/component/Layout.jsx index 6500a31a..bb708467 100644 --- a/src/components/Header/component/Layout.jsx +++ b/src/components/Header/component/Layout.jsx @@ -6,14 +6,19 @@ import openHoc, { type Open } from '~/components/hoc/OpenHoc' import Col from '~/components/layout/Col' import Img from '~/components/layout/Img' import Row from '~/components/layout/Row' +import Grow from '@material-ui/core/Grow' +import ClickAwayListener from '@material-ui/core/ClickAwayListener' +import Popper from '@material-ui/core/Popper' import Spacer from '~/components/Spacer' import { border, sm, md } from '~/theme/variables' +import Provider from './Provider' const logo = require('../assets/gnosis-safe-logo.svg') type Props = Open & { classes: Object, - children: React$Node, + providerDetails: React$Node, + providerInfo: React$Node, } const styles = () => ({ @@ -29,7 +34,9 @@ const styles = () => ({ }, }) -const Header = openHoc(({ classes, children }: Props) => ( +const Layout = openHoc(({ + open, toggle, classes, providerInfo, providerDetails, +}: Props) => ( @@ -38,9 +45,23 @@ const Header = openHoc(({ classes, children }: Props) => ( - { children } + + {providerRef => ( + + {({ TransitionProps }) => ( + + + {providerDetails} + + + )} + + )} + )) -export default withStyles(styles)(Header) +export default withStyles(styles)(Layout) diff --git a/src/components/Header/component/Layout.stories.js b/src/components/Header/component/Layout.stories.js index 778744d4..b3196d93 100644 --- a/src/components/Header/component/Layout.stories.js +++ b/src/components/Header/component/Layout.stories.js @@ -1,9 +1,12 @@ // @flow -import { select } from '@storybook/addon-knobs' import { storiesOf } from '@storybook/react' import * as React from 'react' import styles from '~/components/layout/PageFrame/index.scss' -import Component from './Layout' +import Layout from './Layout' +import ProviderInfo from './ProviderInfo' +import ProviderDetails from './ProviderInfo/UserDetails' +import ProviderDisconnected from './ProviderDisconnected' +import ConnectDetails from './ProviderDisconnected/ConnectDetails' const FrameDecorator = story => (
@@ -13,8 +16,18 @@ const FrameDecorator = story => ( storiesOf('Components', module) .addDecorator(FrameDecorator) - .add('Header', () => { - // https://github.com/storybooks/storybook/tree/master/addons/knobs#select - const provider = select('Status by Provider', ['', 'UNKNOWN', 'METAMASK', 'PARITY'], 'METAMASK') - return {}} /> + .add('Connected Header', () => { + const provider = 'METAMASK' + const userAddress = '0x873faa4cddd5b157e8e5a57e7a5479afc5d30moe' + const network = 'RINKEBY' + const info = + const details = + + return + }) + .add('Disconnected Header', () => { + const info = + const details = + + return })