From 5bc55ac0a801cbe82c41a10f7e680612be4deaf8 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 13 Dec 2021 16:42:50 +0100 Subject: chore: create homepage with graphql data --- src/pages/index.tsx | 80 ++++++++++------------------------------------------- 1 file changed, 15 insertions(+), 65 deletions(-) (limited to 'src/pages/index.tsx') diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 615fe0a..6654617 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,75 +1,22 @@ +import type { ReactElement } from 'react'; +import { GetStaticProps } from 'next'; +import Head from 'next/head'; import Layout from '@components/Layouts/Layout'; +import { seo } from '@config/seo'; +import { getHomePage } from '@services/graphql/homepage'; import { NextPageWithLayout } from '@ts/types/app'; +import { HomePage, HomePageProps } from '@ts/types/homepage'; import { loadTranslation } from '@utils/helpers/i18n'; -import { GetStaticProps } from 'next'; -import Head from 'next/head'; -import Image from 'next/image'; -import type { ReactElement } from 'react'; -import styles from '../styles/Home.module.css'; -const Home: NextPageWithLayout = () => { +const Home: NextPageWithLayout = ({ data }) => { return ( -
+ <> - Create Next App - - + {seo.homepage.title} + - -
-

- Welcome to Next.js! -

- -

- Get started by editing{' '} - pages/index.tsx -

- -
- -

Documentation →

-

Find in-depth information about Next.js features and API.

-
- - -

Learn →

-

Learn about Next.js in an interactive course with quizzes!

-
- - -

Examples →

-

Discover and deploy boilerplate example Next.js projects.

-
- - -

Deploy →

-

- Instantly deploy your Next.js site to a public URL with Vercel. -

-
-
-
- - -
+
+ ); }; @@ -83,8 +30,11 @@ export const getStaticProps: GetStaticProps = async (ctx) => { process.env.NODE_ENV === 'production' ); + const data: HomePage = await getHomePage(); + return { props: { + data, translation, }, }; -- cgit v1.2.3