-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/navigation component #100
Changes from 7 commits
392f534
a77251b
000550a
63a2725
52f799c
0977bec
41e6584
f62c2ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from 'react' | ||
import { connect as connectFela } from 'react-fela' | ||
import { pipe } 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 styles from '../styles/Navigation' | ||
import { FormattedMessage } from '../../lib/Intl' | ||
|
||
class Navigation extends React.Component { | ||
constructor (props) { | ||
super(props) | ||
this.state = { | ||
drawerOpen: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm a fan of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A++ i agree |
||
} | ||
} | ||
|
||
handleDrawerToggle = () => { | ||
this.setState({ drawerOpen: !this.state.drawerOpen }) | ||
} | ||
|
||
render () { | ||
const { styles } = this.props | ||
return ( | ||
<div> | ||
<AppBar | ||
title={ | ||
<FormattedMessage | ||
id='app.name' | ||
className={styles.labelText} | ||
/> | ||
} | ||
onLeftIconButtonTouchTap={this.handleDrawerToggle} | ||
/> | ||
<Drawer open={this.state.drawerOpen}> | ||
<MenuItem | ||
leftIcon={ | ||
<i className="fa fa-bars" aria-hidden="true"/> | ||
} | ||
onTouchTap={this.handleDrawerToggle} | ||
> | ||
<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 pipe( | ||
connectFela(styles) | ||
)(Navigation) |
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 /> | ||
)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require('./Button') | ||
require('./TextField') | ||
require('./AvatarField') | ||
require('./Navigation') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
container: (props) => ({}), | ||
labelText: () => ({ | ||
textTransform: 'capitalize' | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know i mentioned this before, but what do you think about using
recompose
to handle stateful or lifecycle components? while i did say "functional purity" can be a trap, i am enjoying usingrecompose
so far.so this would be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeaaaahhh nice ! i wanted to ask you how to do this actually - will give it a go!