Moving List wrapper to Provider

This commit is contained in:
apanizo 2018-09-05 10:36:48 +02:00
parent e73c5b36e4
commit b97a722068
3 changed files with 83 additions and 12 deletions

View File

@ -1,14 +1,15 @@
// @flow // @flow
import * as React from 'react' import * as React from 'react'
import { withStyles } from '@material-ui/core/styles' import { withStyles } from '@material-ui/core/styles'
import Grow from '@material-ui/core/Grow'
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
import Popper from '@material-ui/core/Popper'
import List from '@material-ui/core/List'
import Divider from '~/components/layout/Divider' import Divider from '~/components/layout/Divider'
import openHoc, { type Open } from '~/components/hoc/OpenHoc' import openHoc, { type Open } from '~/components/hoc/OpenHoc'
import Col from '~/components/layout/Col' import Col from '~/components/layout/Col'
import Img from '~/components/layout/Img' import Img from '~/components/layout/Img'
import Row from '~/components/layout/Row' 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 Spacer from '~/components/Spacer'
import { border, sm, md } from '~/theme/variables' import { border, sm, md } from '~/theme/variables'
import Provider from './Provider' import Provider from './Provider'
@ -22,6 +23,13 @@ type Props = Open & {
} }
const styles = () => ({ const styles = () => ({
root: {
backgroundColor: 'white',
padding: 0,
boxShadow: '0 0 10px 0 rgba(33, 48, 77, 0.1)',
minWidth: '280px',
left: '4px',
},
summary: { summary: {
borderBottom: `solid 2px ${border}`, borderBottom: `solid 2px ${border}`,
alignItems: 'center', alignItems: 'center',
@ -53,7 +61,9 @@ const Layout = openHoc(({
{...TransitionProps} {...TransitionProps}
> >
<ClickAwayListener onClickAway={toggle}> <ClickAwayListener onClickAway={toggle}>
<List className={classes.root} component="div">
{providerDetails} {providerDetails}
</List>
</ClickAwayListener> </ClickAwayListener>
</Grow> </Grow>
)} )}

View File

@ -0,0 +1,67 @@
// @flow
import * as React from 'react'
import { withStyles } from '@material-ui/core/styles'
import Paragraph from '~/components/layout/Paragraph'
import Button from '~/components/layout/Button'
import Hairline from '~/components/layout/Hairline'
import Img from '~/components/layout/Img'
import Row from '~/components/layout/Row'
import { sm, md, lg, background } from '~/theme/variables'
const connectedLogo = require('../../assets/connect-wallet.svg')
type Props = {
classes: Object,
}
const styles = () => ({
container: {
padding: `${md} 12px`,
},
user: {
alignItems: 'center',
backgroundColor: background,
padding: sm,
},
details: {
padding: `0 ${lg}`,
height: '20px',
alignItems: 'center',
},
address: {
flexGrow: 1,
textAlign: 'center',
},
disconnect: {
padding: `${md} 32px`,
},
logo: {
margin: '0px 2px',
},
})
const ConnectDetails = ({ classes }: Props) => (
<React.Fragment>
<div className={classes.container}>
<Row margin="md" align="center">
<Paragraph className={classes.address} size="lg" noMargin bolder>Connect a Wallet</Paragraph>
</Row>
</div>
<Row className={classes.details}>
<Img className={classes.logo} src={connectedLogo} height={16} alt="Status connected" />
</Row>
<Hairline margin="xs" />
<Row className={classes.disconnect}>
<Button
size="medium"
variant="raised"
color="primary"
fullWidth
>
CONNECT
</Button>
</Row>
</React.Fragment>
)
export default withStyles(styles)(ConnectDetails)

View File

@ -4,7 +4,6 @@ import OpenInNew from '@material-ui/icons/OpenInNew'
import { withStyles } from '@material-ui/core/styles' import { withStyles } from '@material-ui/core/styles'
import Paragraph from '~/components/layout/Paragraph' import Paragraph from '~/components/layout/Paragraph'
import Button from '~/components/layout/Button' import Button from '~/components/layout/Button'
import List from '@material-ui/core/List'
import Identicon from '~/components/Identicon' import Identicon from '~/components/Identicon'
import Bold from '~/components/layout/Bold' import Bold from '~/components/layout/Bold'
import Hairline from '~/components/layout/Hairline' import Hairline from '~/components/layout/Hairline'
@ -32,11 +31,6 @@ const openIconStyle = {
} }
const styles = () => ({ const styles = () => ({
root: {
backgroundColor: 'white',
padding: 0,
boxShadow: '0 0 10px 0 rgba(33, 48, 77, 0.1)',
},
container: { container: {
padding: `${md} 12px`, padding: `${md} 12px`,
}, },
@ -72,7 +66,7 @@ const UserDetails = ({
const status = connected ? 'Connected' : 'Not connected' const status = connected ? 'Connected' : 'Not connected'
return ( return (
<List className={classes.root} component="div"> <React.Fragment>
<div className={classes.container}> <div className={classes.container}>
<Row className={classes.identicon} margin="md" align="center"> <Row className={classes.identicon} margin="md" align="center">
<Identicon address={userAddress} diameter={60} /> <Identicon address={userAddress} diameter={60} />
@ -124,7 +118,7 @@ const UserDetails = ({
DISCONNECT DISCONNECT
</Button> </Button>
</Row> </Row>
</List> </React.Fragment>
) )
} }