diff --git a/src/components/App/Header.tsx b/src/components/App/Header.tsx index 86a2acee..3dc82dc7 100644 --- a/src/components/App/Header.tsx +++ b/src/components/App/Header.tsx @@ -1,8 +1,8 @@ import * as React from 'react' -import { Menu } from '../Menu' +import { Navigation } from '../Navigation' const Header: React.FC = props => ( - + ) export default Header diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 54ef5850..698d14fd 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,46 +1,52 @@ import * as React from 'react' import cx from 'classnames' import { getPathWithNoTrailingSlash } from '../../lib/url' -import { MenuToggle } from '../MenuToggle' -import { useScreenType } from '../../hooks/useScreenType' import { MenuItem } from './MenuItem' -import { Overlay } from '../Overlay' const itemUrl = (url: string) => getPathWithNoTrailingSlash(url) export interface IMenuProps { + layout: 'desktop' | 'mobile' items: any[] } export const Menu: React.FC = props => { - const isMobile = useScreenType(['phone', 'tablet']) - const [open, setOpen] = React.useState(false) - const onClick = React.useCallback( - () => { - setOpen(!open) - }, - [open] - ) - return ( - +
- {isMobile ? ( - - ) : props.items.map((item, index) => ( + {props.items.map((item, index) => (
  • = props => { />
  • ))} - - -
    - {props.items.map((item, index) => ( -
  • - -
  • - ))} -
    -
    -
    + ) } diff --git a/src/components/Navigation/index.tsx b/src/components/Navigation/index.tsx new file mode 100644 index 00000000..b330fb8d --- /dev/null +++ b/src/components/Navigation/index.tsx @@ -0,0 +1,64 @@ +import * as React from 'react' +import { MenuToggle } from '../MenuToggle' +import { useScreenType } from '../../hooks/useScreenType' +import { Menu } from '../Menu' +import { Overlay } from '../Overlay' + +export interface INavigationProps { + items: any[] +} + +export const Navigation: React.FC = props => { + const isMobile = useScreenType(['phone', 'tablet']) + const [open, setOpen] = React.useState(false) + const onClick = React.useCallback( + () => { + setOpen(!open) + }, + [open] + ) + + return ( + + ) +}