-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from root-systems/feature/navigation-component
Feature/navigation component
- Loading branch information
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /> | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require('./Button') | ||
require('./TextField') | ||
require('./AvatarField') | ||
require('./Navigation') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
container: (props) => ({}), | ||
labelText: () => ({ | ||
textTransform: 'capitalize' | ||
}) | ||
} |