diff --git a/src/components/Menu/MenuItem.tsx b/src/components/Menu/MenuItem.tsx new file mode 100644 index 00000000..cc6bd5ab --- /dev/null +++ b/src/components/Menu/MenuItem.tsx @@ -0,0 +1,33 @@ +import * as React from 'react' + +export interface IMenuItemProps { + active: boolean + text: string + url: string +} + +export const MenuItem: React.FC = ({ active, text, url }) => ( + <> + + + {active + ? ( + {text} + ) : ( + {text} + ) + } + +) \ No newline at end of file diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 45a375c7..2801423a 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -3,24 +3,10 @@ import cx from 'classnames' import { getPathWithNoTrailingSlash } from '../../lib/url' import { MenuToggle } from './MenuToggle' import { useScreenType } from '../../hooks/useScreenType' +import { MenuItem } from './MenuItem' const itemUrl = (url: string) => getPathWithNoTrailingSlash(url) -const selectedClassName = (flag: boolean) => flag - ? 'selected' - : '' - -const hmenuCurClassName = (flag: boolean) => flag - ? 'HMenu__item--cur' - : '' - -const MenuItem = ({ active, text, url }) => active - ? ( - {text} - ) : ( - {text} - ) - export interface IMenuProps { items: any[] } @@ -40,50 +26,58 @@ export const Menu: React.FC = props => { }, [isMobile]) return ( - + @@ -99,13 +93,16 @@ export const Menu: React.FC = props => { {props.items.map((item, index) => (
  • - +
  • ))}