diff --git a/src/App.js b/src/App.js index bd606a614..f5859310d 100644 --- a/src/App.js +++ b/src/App.js @@ -18,23 +18,32 @@ export class App extends Component { ]).isRequired } + state = { + isNavOpen: true + } + + onToggleNavbar = () => { + this.setState(s => ({isNavOpen: !s.isNavOpen})) + } + componentWillMount () { this.props.doInitIpfs() } render () { const Page = this.props.route + const {isNavOpen} = this.state return (
-
-
- +
+
+
-
+
-
+
diff --git a/src/navigation/NavBar.js b/src/navigation/NavBar.js index 273160457..dbaca8079 100644 --- a/src/navigation/NavBar.js +++ b/src/navigation/NavBar.js @@ -1,6 +1,7 @@ import React from 'react' import { connect } from 'redux-bundler-react' import ipfsLogo from './ipfs-logo.svg' +import ipfsLogoText from './ipfs-logo-text.svg' import StrokeMarketing from '../icons/StrokeMarketing' import StrokeWeb from '../icons/StrokeWeb' import StrokeCube from '../icons/StrokeCube' @@ -10,6 +11,7 @@ import StrokeIpld from '../icons/StrokeIpld' const NavLink = ({ to, icon, + open, exact, disabled, children, @@ -22,8 +24,8 @@ const NavLink = ({ const active = exact ? hash === href : hash && hash.startsWith(href) const cls = active ? className + ' ' + activeClassName : className return ( - - + + - {children} + {open ? children : null} ) } -export const NavBar = ({isSettingsEnabled}) => ( -
- - IPFS - - -
-) +export const NavBar = ({isSettingsEnabled, open, onToggle}) => { + const width = open ? 250 : 100 + return ( +
+
+ IPFS + IPFS +
+ +
+ ) +} -export const NavBarContainer = ({configRaw}) => { +export const NavBarContainer = ({configRaw, ...props}) => { const isSettingsEnabled = !!configRaw.data return ( - + ) } diff --git a/src/navigation/NavBar.stories.js b/src/navigation/NavBar.stories.js index 9076f49e2..975c600dd 100644 --- a/src/navigation/NavBar.stories.js +++ b/src/navigation/NavBar.stories.js @@ -1,6 +1,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' import { checkA11y } from '@storybook/addon-a11y' +import { action } from '@storybook/addon-actions' import { withKnobs, boolean } from '@storybook/addon-knobs' import { NavBar } from './NavBar' @@ -9,7 +10,7 @@ storiesOf('Nav', module) .addDecorator(checkA11y) .addDecorator(withKnobs) .add('sidebar', () => ( -
- +
+
)) diff --git a/src/navigation/ipfs-logo-text.svg b/src/navigation/ipfs-logo-text.svg new file mode 100644 index 000000000..5d24074b6 --- /dev/null +++ b/src/navigation/ipfs-logo-text.svg @@ -0,0 +1 @@ +IPFS logo (new) \ No newline at end of file diff --git a/src/navigation/ipfs-logo.svg b/src/navigation/ipfs-logo.svg index 5d24074b6..a1e2c7f49 100644 --- a/src/navigation/ipfs-logo.svg +++ b/src/navigation/ipfs-logo.svg @@ -1 +1,17 @@ -IPFS logo (new) \ No newline at end of file + + + + + + + + + + + + + + + + +