From 95dd8124b6cc6865d783fe782a9331f1a139e0a1 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Guhur Date: Sun, 11 Dec 2022 22:33:11 +0100 Subject: [PATCH] fix: mobile --- components/Advantages.tsx | 12 +- components/Experience.tsx | 80 ++++++------- components/Share.tsx | 11 +- pages/_app.tsx | 27 ++--- pages/index.tsx | 186 +++++++++++++++++++----------- pages/result/[pid]/[[...tid]].tsx | 1 - pages/vote/[pid]/[[...tid]].tsx | 121 +++++++++++++------ styles/scss/_homePage.scss | 9 +- 8 files changed, 275 insertions(+), 172 deletions(-) diff --git a/components/Advantages.tsx b/components/Advantages.tsx index fe6e1c8..ddf867c 100644 --- a/components/Advantages.tsx +++ b/components/Advantages.tsx @@ -1,12 +1,12 @@ -import {useTranslation} from 'next-i18next'; +import { useTranslation } from 'next-i18next'; import Image from 'next/image'; -import {Row, Col} from 'reactstrap'; +import { Row, Col } from 'reactstrap'; import ballotBox from '../public/urne.svg'; import email from '../public/email.svg'; import respect from '../public/respect.svg'; const AdvantagesRow = () => { - const {t} = useTranslation('resource'); + const { t } = useTranslation('resource'); const resources = [ { src: ballotBox, @@ -28,9 +28,9 @@ const AdvantagesRow = () => { }, ]; return ( - + {resources.map((item, i) => ( - + {item.alt} { ); }; -export default AdvantagesRow +export default AdvantagesRow; diff --git a/components/Experience.tsx b/components/Experience.tsx index d3f6520..fea2de3 100644 --- a/components/Experience.tsx +++ b/components/Experience.tsx @@ -1,47 +1,49 @@ -import {useTranslation} from 'next-i18next'; +import { useTranslation } from 'next-i18next'; import Image from 'next/image'; -import {Row, Col, Button} from 'reactstrap'; +import { Row, Col, Button, Container } from 'reactstrap'; import arrowRight from '../public/arrow-white.svg'; import vote from '../public/vote.svg'; - -const ExperienceRow = () => { - const {t} = useTranslation('resource'); +const Experiencediv = () => { + const { t } = useTranslation('resource'); return ( - - - {t('home.alt-icon-ballot')} - - -

{t('home.experience-name')}

-
- - -
{t('home.experience-1-name')}
-

{t('home.experience-1-desc')}

- - -
{t('home.experience-2-name')}
-

{t('home.experience-2-desc')}

-

- -
- - - - - -
+
+
+ {t('home.alt-icon-ballot')} +
+ +
+

{t('home.experience-name')}

+ + + +
{t('home.experience-1-name')}
+

{t('home.experience-1-desc')}

+ + +
{t('home.experience-2-name')}
+

{t('home.experience-2-desc')}

+

+ +
+
+
+ +
+
); }; - -export default ExperienceRow +export default Experiencediv; diff --git a/components/Share.tsx b/components/Share.tsx index a14226d..36735ab 100644 --- a/components/Share.tsx +++ b/components/Share.tsx @@ -1,19 +1,18 @@ import Image from 'next/image'; -import {useTranslation} from 'next-i18next'; -import {Row, Col} from 'reactstrap'; +import { useTranslation } from 'next-i18next'; +import { Row, Col } from 'reactstrap'; import twitter from '../public/twitter.svg'; import facebook from '../public/facebook.svg'; - interface ShareInterface { title?: string; } -const ShareRow = ({title}: ShareInterface) => { - const {t} = useTranslation('resource'); +const ShareRow = ({ title }: ShareInterface) => { + const { t } = useTranslation('resource'); return ( - {title || t('common.share')} + {title || t('common.share')} -
-
-
-
- -
-
+
+
+
-
+ ); } -const AppWithContext = ({Component, pageProps}) => - - - +const AppWithContext = ({ Component, pageProps }) => ( + + + +); export default appWithTranslation(AppWithContext); diff --git a/pages/index.tsx b/pages/index.tsx index 62e9e88..7af6fb2 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,93 +1,149 @@ -import {useState} from 'react'; +import { useState } from 'react'; import Link from 'next/link'; import Image from 'next/image'; -import {GetStaticProps} from 'next'; -import {serverSideTranslations} from 'next-i18next/serverSideTranslations'; -import {useTranslation} from 'next-i18next'; -import {Container, Row, Col, Button, Input} from 'reactstrap'; +import { GetStaticProps } from 'next'; +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; +import { useTranslation } from 'next-i18next'; +import { Container, Row, Col, Button, Input } from 'reactstrap'; import Logo from '@components/Logo'; import Share from '@components/Share'; -import AdvantagesRow from '@components/Advantages' -import ExperienceRow from '@components/Experience' -import {CREATE_ELECTION} from '@services/routes'; +import AdvantagesRow from '@components/Advantages'; +import ExperienceRow from '@components/Experience'; +import { CREATE_ELECTION } from '@services/routes'; import arrowRight from '../public/arrow-white.svg'; -export const getStaticProps: GetStaticProps = async ({locale}) => ({ +export const getStaticProps: GetStaticProps = async ({ locale }) => ({ props: { ...(await serverSideTranslations(locale, ['resource'])), }, }); const StartForm = () => { - const {t} = useTranslation('resource'); + const { t } = useTranslation('resource'); const [name, setName] = useState(null); return ( -
- - - - -

{t('home.motto')}

-
- -

{t('home.slogan')}

-
- - setName(e.target.value)} - /> + <> + + + + + +

{t('home.motto')}

+
+ +

{t('home.slogan')}

+
+ + setName(e.target.value)} + /> -

250

-
- - - - - - -

{t('home.noAds')}

-
- - -
- +

250

+
+ + + + + + +

{t('home.noAds')}

+
+ + +
+ + + {/** + * Mobile + */} +
+ +

{t('home.motto')}

+

{t('home.slogan')}

+

+ {t('home.slogan')} +

+
+ setName(e.target.value)} + /> + +

250

+
+
+ + + +
+
{t('home.noAds')}
+
+ ); }; - const Home = () => { - const {t} = useTranslation('resource'); + const { t } = useTranslation('resource'); return ( - -
+ <> +
-
-
- + +
+
+ +
+
+ +
- + ); }; diff --git a/pages/result/[pid]/[[...tid]].tsx b/pages/result/[pid]/[[...tid]].tsx index 4119131..839543a 100644 --- a/pages/result/[pid]/[[...tid]].tsx +++ b/pages/result/[pid]/[[...tid]].tsx @@ -146,7 +146,6 @@ const ResultBanner = ({ result }) => { : 'http://localhost'; // We hide the token! const url = `${origin}${RESULTS}/${displayRef(result.ref)}`; - console.log(result); return ( <> diff --git a/pages/vote/[pid]/[[...tid]].tsx b/pages/vote/[pid]/[[...tid]].tsx index 8a99d4d..50141e9 100644 --- a/pages/vote/[pid]/[[...tid]].tsx +++ b/pages/vote/[pid]/[[...tid]].tsx @@ -1,31 +1,25 @@ -import {useRouter} from 'next/router'; -import {serverSideTranslations} from 'next-i18next/serverSideTranslations'; -import {useTranslation} from 'next-i18next'; -import { - Col, - Container, - Row, -} from 'reactstrap'; +import { useRouter } from 'next/router'; +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; +import { useTranslation } from 'next-i18next'; +import { Col, Container, Row } from 'reactstrap'; import Link from 'next/link'; -import Footer from '@components/layouts/Footer'; -import ShareRow from '@components/Share'; +import Share from '@components/Share'; import Button from '@components/Button'; import ExperienceRow from '@components/Experience'; import AdvantagesRow from '@components/Advantages'; import Logo from '@components/Logo'; -import {BALLOT} from '@services/routes'; -import {faArrowRight} from '@fortawesome/free-solid-svg-icons'; -import {displayRef} from '@services/utils'; +import { BALLOT } from '@services/routes'; +import { faArrowRight } from '@fortawesome/free-solid-svg-icons'; +import { displayRef } from '@services/utils'; - -export async function getServerSideProps({query: {pid, tid}, locale}) { +export async function getServerSideProps({ query: { pid, tid }, locale }) { return { props: { ...(await serverSideTranslations(locale, ['resource'])), - electionRef: pid.replaceAll("-", ""), + electionRef: pid.replaceAll('-', ''), token: tid || null, }, - } + }; } interface VoteInterface { @@ -33,13 +27,11 @@ interface VoteInterface { token?: string; } - -const GoToBallotConfirm = ({electionRef, token}) => { - - const {t} = useTranslation(); +const GoToBallotConfirmDesktop = ({ electionRef, token }) => { + const { t } = useTranslation(); return ( -
+
@@ -47,13 +39,16 @@ const GoToBallotConfirm = ({electionRef, token}) => {

{t('common.welcome')}

-

- {t('vote.home-desc')} -

+

{t('vote.home-desc')}

- - +
+ + {t('vote.home-start')} + - +

{t('home.noAds')}

@@ -75,22 +71,71 @@ const GoToBallotConfirm = ({electionRef, token}) => {
- -
- ) -} + +
+ ); +}; +const GoToBallotConfirmMobile = ({ electionRef, token }) => { + const { t } = useTranslation(); + + return ( +
+ + + +

{t('common.welcome')}

+
+ +

{t('vote.home-desc')}

+
-const Vote = ({electionRef, token}: VoteInterface) => { +
+ + + +
+ +

{t('home.noAds')}

+
+ + + + + + +
+ ); +}; +const Vote = ({ electionRef, token }: VoteInterface) => { return ( <>
- + +
-
- +
+
+ +
+
+ +
- +
); diff --git a/styles/scss/_homePage.scss b/styles/scss/_homePage.scss index 91f9b00..8b01be7 100644 --- a/styles/scss/_homePage.scss +++ b/styles/scss/_homePage.scss @@ -62,9 +62,14 @@ $desktop: 1680px; } .sectionTwoHome { background: $mv-dark-blue-color; - padding: 10%; + } +.vote_background { + position: absolute; + right: 0px; + width: 100%; + height: 500px; background-image: url('/vote.svg'); - background-position: top 46% right; + background-position: top right; background-repeat: no-repeat; } .sectionTwoHomeImage {