diff --git a/src/components/Menu.jsx b/src/components/Menu.jsx index 33fdbe0e..6b1bb595 100644 --- a/src/components/Menu.jsx +++ b/src/components/Menu.jsx @@ -1,9 +1,7 @@ import React from 'react' -const getPathWithNoTrailingSlas = require('../lib/url').getPathWithNoTrailingSlash +import {getPathWithNoTrailingSlash} from '../lib/url' -const hasSubmenu = item => !!item.items -const doDrawSubmenu = item => false //item.active && hasSubmenu(item) -const itemUrl = url => getPathWithNoTrailingSlas(url) +const itemUrl = url => getPathWithNoTrailingSlash(url) const selectedClassName = flag => flag ? 'selected' @@ -13,10 +11,12 @@ const hmenuCurClassName = flag => flag ? 'HMenu__item--cur' : '' -const MenuItem = ({ active, text, url }) => (active - ? {text} - : {text} -) +const MenuItem = ({ active, text, url }) => active + ? ( + {text} + ) : ( + {text} + ) const MenuToggle = () => (
@@ -24,32 +24,14 @@ const MenuToggle = () => (
) -export const Menu = ({ items }) => { - const content = items.map((item, index) => ( -
  • - +export const Menu = ({ items }) => ( + + - {!doDrawSubmenu(item) ? null : ( - - )} -
  • - )) - - return ( - - - - {content} - - ) -} - -const Submenu = ({ items }) => ( - {items.map((item, index) => ( -
  • +
  • ))}