-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from opengento/i18n-wip
Add 404 page + fix data provider
- Loading branch information
Showing
14 changed files
with
135 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"use client"; | ||
'use client'; | ||
|
||
import i18next from 'i18next' | ||
import { initReactI18next } from 'react-i18next' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use client'; | ||
|
||
import ContentMedia from "@/components/ContentMedia/ContentMedia"; | ||
import Container from "@/layouts/Container"; | ||
import Typography from "@/components/Typography/Typography"; | ||
import Link from "next/link"; | ||
import ButtonLink from "@/components/ButtonLink/ButtonLink"; | ||
import {FaHome} from "react-icons/fa"; | ||
|
||
export default function Home() { | ||
return ( | ||
<Container size="large" className="flex flex-col gap-8 my-8"> | ||
<ContentMedia> | ||
<Typography | ||
variant="h1" | ||
color="dark" | ||
weight="semibold" | ||
underlineColor="primary-100" | ||
className="mb-6 md:mb-12" | ||
> | ||
404: Vous êtes perdus ! | ||
</Typography> | ||
<ButtonLink | ||
variant="secondary-invert" | ||
href="/" | ||
iconPosition="left" | ||
icon={<FaHome />} | ||
> | ||
Retournez sur la page d’accueil ! | ||
</ButtonLink> | ||
</ContentMedia> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import {ReactNode} from "react"; | ||
import { ReactNode } from "react"; | ||
|
||
type PlaceType = { | ||
export type PlaceProps = { | ||
title: ReactNode; | ||
subtitle: ReactNode; | ||
address: ReactNode; | ||
description: ReactNode; | ||
label: ReactNode; | ||
url: string; | ||
}; | ||
|
||
export type PlaceDataProps = PlaceType; | ||
export type PlaceProps = { | ||
place: PlaceType; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
src/components/TranslationsProvider/TranslationsProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use client'; | ||
|
||
import { useTranslation } from "react-i18next"; | ||
import { SpeakersProps } from "@/components/Speakers/SpeakersProps"; | ||
import { SponsorProps } from "@/components/SponsorList/Sponsor/Sponsor.types"; | ||
import {PlaceProps} from "@/components/Place/PlaceProps"; | ||
|
||
const useData = (ns: string, key: string = 'data') => { | ||
return useTranslation([ns]).t(key, { returnObjects: true }); | ||
} | ||
|
||
const isSpeakersProps = (content: object): content is SpeakersProps => { | ||
return content !== null && typeof content === 'object'; | ||
} | ||
|
||
const isSponsorsProps = (content: object): content is SponsorProps[] => { | ||
return content !== null && typeof content === 'object'; | ||
} | ||
|
||
const isPlaceProps = (content: object): content is PlaceProps => { | ||
return content !== null && typeof content === 'object'; | ||
} | ||
|
||
const useSpeakers = (): SpeakersProps => | ||
{ | ||
const content = useData('speakers'); | ||
if (!isSpeakersProps(content)) { | ||
throw new Error('Content is not a valid Speakers Type'); | ||
} | ||
|
||
return content; | ||
} | ||
|
||
const useSponsors = (): SponsorProps[] => | ||
{ | ||
const content = useData('sponsors'); | ||
if (!isSponsorsProps(content)) { | ||
throw new Error('Content is not a valid array of Sponsor Type'); | ||
} | ||
|
||
return content; | ||
} | ||
|
||
const usePlace = (): PlaceProps => | ||
{ | ||
const content = useData('place'); | ||
if (!isPlaceProps(content)) { | ||
throw new Error('Content is not a valid Place Type'); | ||
} | ||
|
||
return content; | ||
} | ||
|
||
const useDataProvider = () => { | ||
return { | ||
useSponsors: useSponsors, | ||
useSpeakers: useSpeakers, | ||
usePlace: usePlace, | ||
} | ||
}; | ||
|
||
export default useDataProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"use client"; | ||
'use client'; | ||
import { useState } from "react"; | ||
import Link from "next/link"; | ||
|
||
|