From 4045b4bbe53ea417bab1792b7a3a9491e78b3d98 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Guhur Date: Wed, 4 Jan 2023 19:57:01 +0100 Subject: [PATCH] fix: menu --- components/Experience.tsx | 7 +- components/layouts/Footer.tsx | 13 ++- components/layouts/Header.tsx | 196 ++++++++++++++++++-------------- pages/index.tsx | 5 +- pages/vote/[pid]/[[...tid]].tsx | 5 +- services/routes.ts | 7 +- 6 files changed, 134 insertions(+), 99 deletions(-) diff --git a/components/Experience.tsx b/components/Experience.tsx index 649b114..70f0c26 100644 --- a/components/Experience.tsx +++ b/components/Experience.tsx @@ -9,8 +9,11 @@ import vote from '../public/vote.svg'; const Experiencediv = () => { const { t } = useTranslation('resource'); return ( -
-
+
+
{t('home.alt-icon-ballot')}
diff --git a/components/layouts/Footer.tsx b/components/layouts/Footer.tsx index 92aac0c..17a0497 100644 --- a/components/layouts/Footer.tsx +++ b/components/layouts/Footer.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; import { Button, Row, Col } from 'reactstrap'; import Logo from '@components/Logo'; @@ -10,9 +11,11 @@ import { PAYPAL, WHO_WE_ARE_LINK, } from '@services/constants'; +import { getUrl, RouteTypes } from '@services/routes'; const Footer = () => { const { t } = useTranslation(); + const router = useRouter(); const [app, _] = useAppContext(); if (app.fullPage) { @@ -42,10 +45,16 @@ const Footer = () => { ), }, { - component: {t('menu.faq')}, + component: ( + {t('menu.faq')} + ), }, { - component: {t('menu.news')}, + component: ( + + {t('menu.news')} + + ), }, { component: ( diff --git a/components/layouts/Header.tsx b/components/layouts/Header.tsx index 9937f8a..8ab7ebd 100644 --- a/components/layouts/Header.tsx +++ b/components/layouts/Header.tsx @@ -1,20 +1,99 @@ /* eslint react/prop-types: 0 */ -import {useState} from 'react'; -import {Collapse, Nav, NavItem, Button} from 'reactstrap'; +import { useState } from 'react'; +import { Collapse, Nav, NavItem, Button } from 'reactstrap'; import Link from 'next/link'; import Image from 'next/image'; -import {useTranslation} from 'next-i18next'; -import {useAppContext} from '@services/context'; +import { useTranslation } from 'next-i18next'; +import { useAppContext } from '@services/context'; import LanguageSelector from './LanguageSelector'; import openMenuIcon from '../../public/open-menu-icon.svg'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faXmark } from '@fortawesome/free-solid-svg-icons'; +import { + CONTACT_MAIL, + MAJORITY_JUDGMENT_LINK, + NEWS_LINK, + PAYPAL, + WHO_WE_ARE_LINK, +} from '@services/constants'; +import ShareRow from '@components/Share'; +import { getUrl, RouteTypes } from '@services/routes'; +import { useRouter } from 'next/router'; +import Logo from '@components/Logo'; const Header = () => { const [isOpen, setOpen] = useState(false); + const router = useRouter(); + const { t } = useTranslation(); const [app, _] = useAppContext(); const toggle = () => setOpen(!isOpen); - if (app.fullPage) {return null;} + if (app.fullPage) { + return null; + } + + const menu = [ + { + component: ( + + {t('menu.majority-judgment')} + + ), + }, + { + component: ( + + {t('menu.whoarewe')} + + ), + }, + { + component: ( + + {t('menu.faq')} + + ), + }, + { + component: ( + + {t('menu.news')} + + ), + }, + { + component: ( + + {t('menu.contact-us')} + + ), + }, + { + component: , + }, + ]; return ( <> @@ -30,90 +109,39 @@ const Header = () => { diff --git a/pages/index.tsx b/pages/index.tsx index 6469445..813abe5 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -138,10 +138,7 @@ const Home = () => {
-
- -
-
+
diff --git a/pages/vote/[pid]/[[...tid]].tsx b/pages/vote/[pid]/[[...tid]].tsx index 069c3cd..45258dd 100644 --- a/pages/vote/[pid]/[[...tid]].tsx +++ b/pages/vote/[pid]/[[...tid]].tsx @@ -129,10 +129,7 @@ const Vote = ({ electionRef, token }: VoteInterface) => {
-
- -
-
+
diff --git a/services/routes.ts b/services/routes.ts index 39ad9b5..bb0fda8 100644 --- a/services/routes.ts +++ b/services/routes.ts @@ -5,13 +5,14 @@ import { NextRouter } from 'next/router'; import { getWindowUrl, displayRef, getLocaleShort } from './utils'; export enum RouteTypes { - HOME = '', - CREATE_ELECTION = 'admin/new', ADMIN = 'admin', BALLOT = 'ballot', + CREATE_ELECTION = 'admin/new', ENDED_VOTE = 'end', - VOTE = 'vote', + FAQ = 'faq', + HOME = '', RESULTS = 'result', + VOTE = 'vote', } export const getUrl = (