Skip to content

Commit

Permalink
Merge pull request #100 from root-systems/feature/navigation-component
Browse files Browse the repository at this point in the history
Feature/navigation component
  • Loading branch information
ahdinosaur authored Jul 13, 2017
2 parents b9df373 + f62c2ec commit 9be488c
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
73 changes: 73 additions & 0 deletions app/components/Navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from 'react'
import { connect as connectFela } from 'react-fela'
import { not } from 'ramda'
import AppBar from 'material-ui/AppBar'
import Drawer from 'material-ui/Drawer'
import MenuItem from 'material-ui/MenuItem'
import Divider from 'material-ui/Divider'
import { withState, withHandlers, compose } from 'recompose'

import styles from '../styles/Navigation'
import { FormattedMessage } from '../../lib/Intl'

function Navigation (props) {
const { styles, isDrawerOpen, toggleDrawer } = props

return (
<div>
<AppBar
title={
<FormattedMessage
id='app.name'
className={styles.labelText}
/>
}
onLeftIconButtonTouchTap={toggleDrawer}
/>
<Drawer open={isDrawerOpen}>
<MenuItem
leftIcon={
<i className="fa fa-bars" aria-hidden="true"/>
}
onTouchTap={toggleDrawer}
>
<FormattedMessage
id='app.closeMenu'
className={styles.labelText}
/>
</MenuItem>
<Divider />
<MenuItem
leftIcon={
<i className="fa fa-tachometer" aria-hidden="true" />
}
>
<FormattedMessage
id='app.dashboard'
className={styles.labelText}
/>
</MenuItem>
<Divider />
<MenuItem
leftIcon={
<i className="fa fa-sign-out" aria-hidden="true" />
}
>
<FormattedMessage
id='app.logOut'
className={styles.labelText}
/>
</MenuItem>
<Divider />
</Drawer>
</div>
)
}

export default compose(
connectFela(styles),
withState('isDrawerOpen', 'setDrawerOpen', false),
withHandlers({
toggleDrawer: ({ setDrawerOpen }) => () => setDrawerOpen(not)
})
)(Navigation)
3 changes: 3 additions & 0 deletions app/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"app.name": "Cobuy",
"app.closeMenu": "close menu",
"app.dashboard": "dashboard",
"app.logOut": "log out",
"agents.nameLabel": "name",
"agents.descriptionLabel": "description",
"agents.logout": "log out",
Expand Down
9 changes: 9 additions & 0 deletions app/stories/Navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import { storiesOf } from '@storybook/react'

import Navigation from '../components/Navigation'

storiesOf('app.Navigation', module)
.add('default', () => (
<Navigation />
))
1 change: 1 addition & 0 deletions app/stories/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('./Button')
require('./TextField')
require('./AvatarField')
require('./Navigation')
6 changes: 6 additions & 0 deletions app/styles/Navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
container: (props) => ({}),
labelText: () => ({
textTransform: 'capitalize'
})
}

0 comments on commit 9be488c

Please sign in to comment.