From 769d4412706dccae633a2b0fbcea062f571cb378 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 15 Nov 2022 14:44:51 +0100 Subject: [PATCH] add - nettoayge & refacto du layout --- components/Content.tsx | 76 ------ components/Layout.tsx | 2 +- .../{ => _fichier_exemple_}/api/post/[id].ts | 2 +- .../{ => _fichier_exemple_}/api/post/index.ts | 2 +- .../api/profile/index.ts | 2 +- .../api/publish/[id].ts | 2 +- pages/{ => _fichier_exemple_}/create.tsx | 2 +- pages/{ => _fichier_exemple_}/drafts.tsx | 10 +- pages/{ => _fichier_exemple_}/p/[id].tsx | 8 +- pages/{ => _fichier_exemple_}/profile.tsx | 6 +- pages/connexion.tsx | 91 ++++--- pages/index.tsx | 87 ++++-- pages/verify-request.tsx | 23 +- styles/Connexion.module.css | 48 ++++ styles/Content.module.css | 252 ------------------ styles/Index.module.css | 173 ++++++++++++ 16 files changed, 370 insertions(+), 416 deletions(-) delete mode 100644 components/Content.tsx rename pages/{ => _fichier_exemple_}/api/post/[id].ts (93%) rename pages/{ => _fichier_exemple_}/api/post/index.ts (93%) rename pages/{ => _fichier_exemple_}/api/profile/index.ts (95%) rename pages/{ => _fichier_exemple_}/api/publish/[id].ts (92%) rename pages/{ => _fichier_exemple_}/create.tsx (97%) rename pages/{ => _fichier_exemple_}/drafts.tsx (86%) rename pages/{ => _fichier_exemple_}/p/[id].tsx (91%) rename pages/{ => _fichier_exemple_}/profile.tsx (96%) delete mode 100644 styles/Content.module.css diff --git a/components/Content.tsx b/components/Content.tsx deleted file mode 100644 index 50101c9..0000000 --- a/components/Content.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import React from "react"; - - -import Image from 'next/image'; - - -import style from '../styles/Content.module.css'; - - -import Link from "next/link"; - - -import feuilleGauche from '../public/images/feuilleGauche.webp' -import feuilleDroite from '../public/images/feuilleBasDroite.webp' -import cadeau from '../public/images/cadeau.webp' -import jeuConcours from '../public/images/jeuconcours.webp' -import footerGrass from '../public/images/footer_image.webp' - - -type Props = { - children?: React.ReactNode; -}; - -const Content = ({ children }: Props) => { - return ( - <> -
-
- thetiptop feuille Gauche -
-
- thetiptop feuille Droite -
-
- thetiptop jeu Concours -
-
- thetiptop cadeau -
-
- {children} -
-
- thetiptop feuille Gauche -
-
- - ); -}; - -export default Content; diff --git a/components/Layout.tsx b/components/Layout.tsx index ce22eb0..03ab31c 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -15,7 +15,7 @@ const layoutStyle = { const Layout = ({ children }: Props) =>
- + {children}
diff --git a/pages/api/post/[id].ts b/pages/_fichier_exemple_/api/post/[id].ts similarity index 93% rename from pages/api/post/[id].ts rename to pages/_fichier_exemple_/api/post/[id].ts index 05c9883..c25f56c 100644 --- a/pages/api/post/[id].ts +++ b/pages/_fichier_exemple_/api/post/[id].ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from 'next' import { getSession } from 'next-auth/react'; -import prisma from '../../../lib/prisma' +import prisma from '../../../../lib/prisma' // DELETE /api/post/:id diff --git a/pages/api/post/index.ts b/pages/_fichier_exemple_/api/post/index.ts similarity index 93% rename from pages/api/post/index.ts rename to pages/_fichier_exemple_/api/post/index.ts index f67e56d..3f8b12e 100644 --- a/pages/api/post/index.ts +++ b/pages/_fichier_exemple_/api/post/index.ts @@ -1,5 +1,5 @@ import type { NextApiRequest, NextApiResponse } from 'next' -import prisma from '../../../lib/prisma' +import prisma from '../../../../lib/prisma' import { getSession } from 'next-auth/react' diff --git a/pages/api/profile/index.ts b/pages/_fichier_exemple_/api/profile/index.ts similarity index 95% rename from pages/api/profile/index.ts rename to pages/_fichier_exemple_/api/profile/index.ts index c89e344..2d03ede 100644 --- a/pages/api/profile/index.ts +++ b/pages/_fichier_exemple_/api/profile/index.ts @@ -1,5 +1,5 @@ import type { NextApiRequest, NextApiResponse } from 'next' -import prisma from '../../../lib/prisma' +import prisma from '../../../../lib/prisma' import { getSession } from 'next-auth/react' diff --git a/pages/api/publish/[id].ts b/pages/_fichier_exemple_/api/publish/[id].ts similarity index 92% rename from pages/api/publish/[id].ts rename to pages/_fichier_exemple_/api/publish/[id].ts index eeb9fb7..3d1f064 100644 --- a/pages/api/publish/[id].ts +++ b/pages/_fichier_exemple_/api/publish/[id].ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from 'next' import { getSession } from 'next-auth/react'; -import prisma from '../../../lib/prisma' +import prisma from '../../../../lib/prisma' // PUT /api/publish/:id export default async function handle(req: NextApiRequest, res: NextApiResponse) { diff --git a/pages/create.tsx b/pages/_fichier_exemple_/create.tsx similarity index 97% rename from pages/create.tsx rename to pages/_fichier_exemple_/create.tsx index c76555e..d9f8b1a 100644 --- a/pages/create.tsx +++ b/pages/_fichier_exemple_/create.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import Layout from "../components/Layout"; +import Layout from "../../components/Layout"; import Router from "next/router"; const Draft = () => { diff --git a/pages/drafts.tsx b/pages/_fichier_exemple_/drafts.tsx similarity index 86% rename from pages/drafts.tsx rename to pages/_fichier_exemple_/drafts.tsx index 2f9059d..e89283a 100644 --- a/pages/drafts.tsx +++ b/pages/_fichier_exemple_/drafts.tsx @@ -1,9 +1,9 @@ import React from "react"; import { GetServerSideProps } from "next"; -import Layout from "../components/Layout"; -import Post, { PostProps } from "../components/Post"; +import Layout from "../../components/Layout"; +import Post, { PostProps } from "../../components/Post"; import { useSession, getSession } from "next-auth/react"; -import prisma from '../lib/prisma' +import prisma from '../../lib/prisma' export const getServerSideProps: GetServerSideProps = async ({ req, res }) => { @@ -33,8 +33,8 @@ type Props = { drafts: PostProps[]; }; -const Drafts = (props : Props) => { - const {data: session}= useSession(); +const Drafts = (props: Props) => { + const { data: session } = useSession(); if (!session) { return ( diff --git a/pages/p/[id].tsx b/pages/_fichier_exemple_/p/[id].tsx similarity index 91% rename from pages/p/[id].tsx rename to pages/_fichier_exemple_/p/[id].tsx index 1dbffea..f11fa58 100644 --- a/pages/p/[id].tsx +++ b/pages/_fichier_exemple_/p/[id].tsx @@ -1,10 +1,10 @@ import React from "react"; import { GetServerSideProps } from "next"; import ReactMarkdown from "react-markdown"; -import Layout from "../../components/Layout"; +import Layout from "../../../components/Layout"; import Router from "next/router"; -import { PostProps } from "../../components/Post"; -import prisma from '../../lib/prisma' +import { PostProps } from "../../../components/Post"; +import prisma from '../../../lib/prisma' import { useSession } from "next-auth/react"; @@ -38,7 +38,7 @@ async function deletePost(id: number): Promise { await Router.push("/") } -const Post = (props : PostProps) => { +const Post = (props: PostProps) => { const { data: session, status } = useSession(); if (status === 'loading') { return
Authenticating ...
; diff --git a/pages/profile.tsx b/pages/_fichier_exemple_/profile.tsx similarity index 96% rename from pages/profile.tsx rename to pages/_fichier_exemple_/profile.tsx index 8d180d7..d9faaa1 100644 --- a/pages/profile.tsx +++ b/pages/_fichier_exemple_/profile.tsx @@ -1,10 +1,10 @@ import React, { useState } from "react"; import { GetServerSideProps } from "next"; -import Layout from "../components/Layout"; +import Layout from "../../components/Layout"; import { useSession, getSession } from "next-auth/react"; -import prisma from '../lib/prisma' +import prisma from '../../lib/prisma' import Router from "next/router"; -import { ProfileProps } from "../types/profile"; +import { ProfileProps } from "../../types/profile"; import { Resolver, SubmitHandler } from "react-hook-form"; diff --git a/pages/connexion.tsx b/pages/connexion.tsx index 2d22ed2..0c9d20a 100644 --- a/pages/connexion.tsx +++ b/pages/connexion.tsx @@ -130,47 +130,56 @@ const MainPage = ({ csrfToken }: Props) => { -
-

Connexion

- - -
-
- -
- -
-
-
-
- -
-
- - -
-
-
+ +
+
+ + + +
+

Connexion

+ + +
+
+ +
+ +
+
+
+
+ +
+
+ + +
+
+
+ +
+
) }; diff --git a/pages/index.tsx b/pages/index.tsx index c430c46..e8d13f3 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -10,8 +10,8 @@ import { yupResolver } from "@hookform/resolvers/yup"; import { useForm } from "react-hook-form"; import Router from "next/router"; -import Section from '../components/Section'; -import style from '../styles/index.module.css'; + +import style from '../styles/Index.module.css'; import rotatingLeftImage from '../public/images/coffret-degustation-mousselines-individuelles-n3-PhotoRoom.webp'; import rotatingRightImage from '../public/images/coffret-the-PhotoRoom.webp'; @@ -23,6 +23,7 @@ import feuilleDroite from '../public/images/feuilleBasDroite.webp' import unAnDeThe from '../public/images/unandethé.webp' import sablier from '../public/images/sablier.webp' import cadeau from '../public/images/cadeau.webp' +import footerGrass from '../public/images/footer_image.webp' import jeuConcours from '../public/images/jeuconcours.webp' import { GetServerSideProps } from "next"; @@ -108,31 +109,75 @@ const MainPage = () => { -
-
+
+
thetiptop navigation logo
-
-
- - Code à usage unique -
{errors.codeCadeau?.message}
+
+ thetiptop feuille Droite +
+
+ thetiptop jeu Concours +
+
+ thetiptop cadeau +
+
+
+
+ thetiptop navigation logo +
+ +
+ + Code à usage unique +
{errors.codeCadeau?.message}
+
+
+ +
+
-
- +
+ thetiptop feuille Gauche
- +
); diff --git a/pages/verify-request.tsx b/pages/verify-request.tsx index f304887..b941888 100644 --- a/pages/verify-request.tsx +++ b/pages/verify-request.tsx @@ -44,15 +44,22 @@ const VerifyRequest = () => { -
-

Un email a été envoyé

- -
- + +
+
+ + +
+

Un email a été envoyé

+ +
+ +
+
-
+
) }; diff --git a/styles/Connexion.module.css b/styles/Connexion.module.css index 24c099c..c500d11 100644 --- a/styles/Connexion.module.css +++ b/styles/Connexion.module.css @@ -11,4 +11,52 @@ .imageWrapper { display: block; +} + +.masthead { + --aButton-base-padding: 0px; + --aButton-grow-padding: 5px; +} + +.masthead { + background-image: url('/images/pageprincipale.webp'); + background-size: cover; + background-position: 50% 50%; + background-repeat: no-repeat; + padding-top: 5vh; + height: 90vh; + position: relative; +} + +.masthead .aButton { + position: relative; +} + +.masthead .aButton:after { + content: ""; + position: absolute; + + /* border:1px solid black; */ + border-radius: 0.375rem; + display: none; + + left: var(--aButton-base-padding); + top: var(--aButton-base-padding); + width: calc(100% + var(--aButton-base-padding)); + height: calc(100% + var(--aButton-base-padding)); +} + +.masthead .aButton:hover:after { + display: block; + animation: 0.7s linear infinite alternate expand; +} + +@keyframes expand { + to { + left: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); + top: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); + width: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); + height: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); + border: 3px solid var(--color3); + } } \ No newline at end of file diff --git a/styles/Content.module.css b/styles/Content.module.css deleted file mode 100644 index 0f47dc2..0000000 --- a/styles/Content.module.css +++ /dev/null @@ -1,252 +0,0 @@ -.masthead { - --aButton-base-padding: 0px; - --aButton-grow-padding: 5px; -} - -.masthead { - background-image: url('/images/pageprincipale.webp'); - background-size: cover; - background-position: 50% 50%; - background-repeat: no-repeat; - padding-top: 5vh; - height: 90vh; - position: relative; -} - -.footerGrass { - position: absolute; - background-image: url('/image/footer_image.webp'); - background-repeat: repeat-x; - background-size: contain; - width: 100vw; - /* animation: moveLeftRight 2s infinite; */ - position: absolute; - bottom: -20px; -} - -@keyframes moveLeftRight { - - - 0%, - 100% { - left: 10%; - } - - 50% { - right: 0; - } -} - - -.bloc-content { - padding: 10vh; - border-radius: 10px; - background-image: url('/images/codebackground.webp'); - background-position: 50% 50%; - background-repeat: no-repeat; - background-size: contain; - /* animation: zoomInOut 3s ease-in-out infinite; */ - z-index: 8888 -} - -.zoomInOutCadeau { - animation: zoomInOut 1s ease-in-out infinite; -} - -.zoomInOutJeuConcours { - animation: zoomInOut 1.1s ease-in-out infinite; -} - - -.rotatingImage { - animation: 1s ease-in-out infinite alternate rotation; -} - -.rotatingSlow { - animation: 4s ease-in-out infinite alternate rotation; -} - -.blinking { - animation: blinking 1s infinite; -} - -@keyframes zoomInOut { - 0% { - transform: scale(1, 1); - } - - 50% { - transform: scale(1.05, 1.05); - } - - to { - transform: scale(1, 1); - } -} - - - -@keyframes rotation { - 0% { - transform: rotate(2deg); - } - - 50% { - transform: rotate(-2deg); - } - - to { - transform: rotate(2deg); - } -} - -@keyframes blinking { - - 0%, - 50%, - 100% { - opacity: 1; - } - - 25%, - 75% { - opacity: 0; - } -} - -.zoom-in-out-box { - animation: zoom-in-zoom-out 1s ease infinite; -} - -.imageWrapper { - display: block; -} - -.masthead .aButton { - position: relative; -} - -.masthead .aButton:after { - content: ""; - position: absolute; - - /* border:1px solid black; */ - border-radius: 0.375rem; - display: none; - - left: var(--aButton-base-padding); - top: var(--aButton-base-padding); - width: calc(100% + var(--aButton-base-padding)); - height: calc(100% + var(--aButton-base-padding)); -} - -.masthead .aButton:hover:after { - display: block; - animation: 0.7s linear infinite alternate expand; -} - -@keyframes expand { - to { - left: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); - top: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); - width: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); - height: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); - border: 3px solid var(--color3); - } -} - -.productToGain { - background-color: var(--color1); - width: 20vw; - height: 20vw; - border-radius: 50%; - padding: 10px; - position: relative; -} - - -@media (min-width: 992px) { - .productToGain { - width: 13vw; - height: 13vw; - } -} - - -/*mobile*/ -@media only screen and (max-width: 767px) { - .feuilleGauche { - position: absolute; - top: 0px; - left: 0px; - z-index: 9000; - width: 25vw; - } - - .feuilleDroite { - position: absolute; - bottom: 0px; - right: 0px; - z-index: 9000; - width: 25vw; - } - - .cadeau { - position: absolute; - bottom: 0px; - left: 0px; - z-index: 9000; - } - - .jeuConcours { - position: absolute; - top: 0px; - right: 0px; - z-index: 9000; - } - - .footerGrass { - position: absolute; - background-image: url('/image/footer_image.webp'); - background-size: contain; - width: 100vw; - bottom: -10px; - - } - - - -} - -/*grand écran*/ -@media only screen and (min-width: 767px) { - .feuilleGauche { - position: absolute; - top: 1px; - left: 1px; - z-index: 9000; - width: 25vw; - } - - .feuilleDroite { - position: absolute; - bottom: 15px; - right: 15px; - z-index: 9000; - width: 25vw; - } - - .cadeau { - position: absolute; - bottom: 0px; - left: 0px; - z-index: 9000; - } - - .jeuConcours { - position: absolute; - top: 15px; - right: 15px; - z-index: 9000; - } -} \ No newline at end of file diff --git a/styles/Index.module.css b/styles/Index.module.css index ec09fc0..b1468d5 100644 --- a/styles/Index.module.css +++ b/styles/Index.module.css @@ -1,3 +1,43 @@ +.masthead { + --aButton-base-padding: 0px; + --aButton-grow-padding: 5px; +} + +.masthead { + background-image: url('/images/pageprincipale.webp'); + background-size: cover; + background-position: 50% 50%; + background-repeat: no-repeat; + padding-top: 5vh; + height: 90vh; + position: relative; +} + +.footerGrass { + position: absolute; + background-image: url('/image/footer_image.webp'); + background-repeat: repeat-x; + background-size: contain; + width: 100vw; + /* animation: moveLeftRight 2s infinite; */ + position: absolute; + bottom: -20px; +} + +@keyframes moveLeftRight { + + + 0%, + 100% { + left: 10%; + } + + 50% { + right: 0; + } +} + + .bloc-content { padding: 10vh; border-radius: 10px; @@ -26,6 +66,10 @@ animation: 4s ease-in-out infinite alternate rotation; } +.blinking { + animation: blinking 1s infinite; +} + @keyframes zoomInOut { 0% { transform: scale(1, 1); @@ -76,4 +120,133 @@ .imageWrapper { display: block; +} + +.masthead .aButton { + position: relative; +} + +.masthead .aButton:after { + content: ""; + position: absolute; + + /* border:1px solid black; */ + border-radius: 0.375rem; + display: none; + + left: var(--aButton-base-padding); + top: var(--aButton-base-padding); + width: calc(100% + var(--aButton-base-padding)); + height: calc(100% + var(--aButton-base-padding)); +} + +.masthead .aButton:hover:after { + display: block; + animation: 0.7s linear infinite alternate expand; +} + +@keyframes expand { + to { + left: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); + top: calc(var(--aButton-base-padding) - var(--aButton-grow-padding)); + width: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); + height: calc(100% + var(--aButton-base-padding) + 2 * var(--aButton-grow-padding)); + border: 3px solid var(--color3); + } +} + +.productToGain { + background-color: var(--color1); + width: 20vw; + height: 20vw; + border-radius: 50%; + padding: 10px; + position: relative; +} + + +@media (min-width: 992px) { + .productToGain { + width: 13vw; + height: 13vw; + } +} + + +/*mobile*/ +@media only screen and (max-width: 767px) { + .feuilleGauche { + position: absolute; + top: 0px; + left: 0px; + z-index: 9000; + width: 25vw; + } + + .feuilleDroite { + position: absolute; + bottom: 0px; + right: 0px; + z-index: 9000; + width: 25vw; + } + + .cadeau { + position: absolute; + bottom: 0px; + left: 0px; + z-index: 9000; + } + + .jeuConcours { + position: absolute; + top: 0px; + right: 0px; + z-index: 9000; + } + + .footerGrass { + position: absolute; + background-image: url('/image/footer_image.webp'); + background-size: contain; + width: 100vw; + bottom: -10px; + + } + + + +} + +/*grand écran*/ +@media only screen and (min-width: 767px) { + .feuilleGauche { + position: absolute; + top: 1px; + left: 1px; + z-index: 9000; + width: 25vw; + } + + .feuilleDroite { + position: absolute; + bottom: 15px; + right: 15px; + z-index: 9000; + width: 25vw; + } + + .cadeau { + position: absolute; + bottom: 0px; + left: 0px; + z-index: 9000; + } + + .jeuConcours { + position: absolute; + top: 15px; + right: 15px; + z-index: 9000; + } } \ No newline at end of file