From aec575c3b5797069e4964cfafa26e3de3b92f99e Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 13 Dec 2021 22:04:03 +0100 Subject: chore: add main-nav component I choose to implement main-nav paths manually instead of fetching them from GraphQL to ensure functional navigation without JS. --- src/components/MainNav/MainNav.tsx | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/components/MainNav/MainNav.tsx (limited to 'src/components/MainNav/MainNav.tsx') diff --git a/src/components/MainNav/MainNav.tsx b/src/components/MainNav/MainNav.tsx new file mode 100644 index 0000000..3140e64 --- /dev/null +++ b/src/components/MainNav/MainNav.tsx @@ -0,0 +1,71 @@ +import { useState } from 'react'; +import Link from 'next/link'; +import { t } from '@lingui/macro'; +import { HamburgerIcon } from '@components/Icons'; +import { mainNav } from '@config/nav'; +import ArticlesIcon from '@assets/images/icon-articles.svg'; +import ContactIcon from '@assets/images/icon-contact.svg'; +import CVIcon from '@assets/images/icon-cv.svg'; +import HomeIcon from '@assets/images/icon-home.svg'; +import styles from './MainNav.module.scss'; + +const MainNav = () => { + const [isChecked, setIsChecked] = useState(false); + + const getIcon = (id: string) => { + switch (id) { + case 'home': + return ; + case 'blog': + return ; + case 'contact': + return ; + case 'cv': + return ; + default: + break; + } + }; + + const navItems = mainNav.map((item) => { + return ( +
  • + + + {getIcon(item.id)} + {item.name} + + +
  • + ); + }); + + return ( +
    + setIsChecked(!isChecked)} + /> + + +
    + ); +}; + +export default MainNav; -- cgit v1.2.3