Skip to content

Commit

Permalink
adding Layout and Dashboard (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
julien51 committed Sep 12, 2018
1 parent 7dc8c93 commit d15ec91
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 7 deletions.
14 changes: 14 additions & 0 deletions unlock-app/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion unlock-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"web3-utils": "^1.0.0-beta.34"
},
"devDependencies": {
"@svgr/cli": "^2.3.0",
"@storybook/addon-jest": "^3.4.10",
"@storybook/react": "^3.4.10",
"@svgr/cli": "^2.3.0",
"babel-core": "^6.26.3",
"enzyme": "^3.4.0",
"enzyme-adapter-react-16": "^1.2.0",
Expand Down
20 changes: 20 additions & 0 deletions unlock-app/src/components/creator/Dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import UnlockPropTypes from '../../propTypes'

import React, { Component } from 'react'
import Layout from '../interface/Layout'
import CreatorAccount from './CreatorAccount'

export default class Dashboard extends Component {
render() {
return (
<Layout title="Creator Dashboard">
<CreatorAccount network={this.props.network} account={this.props.account} />
</Layout>
)
}
}

Dashboard.propTypes = {
account: UnlockPropTypes.account,
network: UnlockPropTypes.network,
}
19 changes: 14 additions & 5 deletions unlock-app/src/components/interface/Header.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import styled from 'styled-components'
import Icons from './icons'
Expand All @@ -6,21 +7,29 @@ export default class Header extends Component {
render() {
return (
<TopHeader>
<h1>Creator Dashboard</h1>
<a><Icons.About /></a>
<a><Icons.Jobs /></a>
<a><Icons.Github /></a>
<h1>{this.props.title}</h1>
<Button><Icons.About /></Button>
<Button><Icons.Jobs /></Button>
<Button><Icons.Github /></Button>
</TopHeader>
)
}
}

Header.propTypes = {
title: PropTypes.string,
}

const TopHeader = styled.header`
display: grid;
grid-gap: 16px;
grid-template-columns: 1fr;
grid-auto-flow: column;
align-items: center;
height: 72px;
font-size: 24px;
`

const Button = styled.a`
display: grid;
align-items: center;
`
47 changes: 47 additions & 0 deletions unlock-app/src/components/interface/Layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import styled from 'styled-components'
import Header from './Header'
import Unlock from './icons/Unlock'

export default class Layout extends Component {
render() {
return (
<Container>
<Left>
<Unlock />
</Left>
<Content>
<Header title={this.props.title} />
{this.props.children}
</Content>
<Right />
</Container>
)
}
}

Layout.propTypes = {
title: PropTypes.string,
children: PropTypes.Component,
}

const Container = styled.div`
display: grid;
padding: 16px;
grid-template-columns: 1fr minmax(300px, 65%) 1fr;
`

const Left = styled.div`
display: grid;
font-size: 56px;
align-items: top;
`

const Right = styled.div`
`

const Content = styled.div`
display: grid;
row-gap: 20px;
`
16 changes: 16 additions & 0 deletions unlock-app/src/stories/creator/Dashboard.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import Dashboard from '../../components/creator/Dashboard'

storiesOf('Dashboard')
.add('the dashboard', () => {
const account = {
address: '0x3ca206264762caf81a8f0a843bbb850987b41e16',
}
const network = {
name: 4,
}
return (
<Dashboard network={network} account={account} />
)
})
7 changes: 6 additions & 1 deletion unlock-app/src/stories/interface/Header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import { storiesOf } from '@storybook/react'
import Header from '../../components/interface/Header'

storiesOf('Header')
.add('the header', () => {
.add('the header without a title', () => {
return (
<Header />
)
})
.add('the header with a title', () => {
return (
<Header title="Roses are red" />
)
})
10 changes: 10 additions & 0 deletions unlock-app/src/stories/interface/Layout.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import Layout from '../../components/interface/Layout'

storiesOf('Layout')
.add('the layout', () => {
return (
<Layout title="The story of Unlock" />
)
})

0 comments on commit d15ec91

Please sign in to comment.