Skip to content

Commit 91c5225

Browse files
committed
add prop types definitions
1 parent 4de30af commit 91c5225

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

src/pages/developers/tutorials.tsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ import { SSRConfig } from "next-i18next"
44
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
55
import { useTranslation } from "react-i18next"
66
import { FaGithub } from "react-icons/fa"
7-
import { Badge, Box, chakra, Flex, forwardRef, Heading, useToken } from "@chakra-ui/react"
7+
import {
8+
Badge,
9+
Box,
10+
chakra,
11+
Flex,
12+
forwardRef,
13+
Heading,
14+
useToken,
15+
} from "@chakra-ui/react"
816

917
import { Lang } from "@/lib/types"
1018

@@ -17,15 +25,18 @@ import OldHeading from "@/components/OldHeading"
1725
import Text from "@/components/OldText"
1826
import PageMetadata from "@/components/PageMetadata"
1927
import Translation from "@/components/Translation"
20-
import { getSkillTranslationId,Skill } from "@/components/TutorialMetadata"
28+
import { getSkillTranslationId, Skill } from "@/components/TutorialMetadata"
2129
import TutorialTags from "@/components/TutorialTags"
2230

2331
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
2432
import { trackCustomEvent } from "@/lib/utils/matomo"
2533
import { getTutorialsData } from "@/lib/utils/md"
26-
import { getLocaleTimestamp,INVALID_DATETIME } from "@/lib/utils/time"
34+
import { getLocaleTimestamp, INVALID_DATETIME } from "@/lib/utils/time"
2735
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
28-
import { filterTutorialsByLang, getSortedTutorialTagsForLang } from "@/lib/utils/tutorial"
36+
import {
37+
filterTutorialsByLang,
38+
getSortedTutorialTagsForLang,
39+
} from "@/lib/utils/tutorial"
2940

3041
import externalTutorials from "@/data/externalTutorials.json"
3142

@@ -60,23 +71,29 @@ const FilterTag = forwardRef<{ isActive: boolean; name: string }, "button">(
6071
}
6172
)
6273

63-
export const getStaticProps = (async (
64-
context
65-
) => {
74+
type Props = SSRConfig & {
75+
internalTutorials: ITutorial[]
76+
locale: string | undefined
77+
lastDeployDate: string
78+
}
79+
80+
export const getStaticProps = (async (context) => {
6681
const { locale } = context
6782
// load i18n required namespaces for the given page
68-
const requiredNamespaces = getRequiredNamespacesForPage('/developers/tutorials')
83+
const requiredNamespaces = getRequiredNamespacesForPage(
84+
"/developers/tutorials"
85+
)
6986
const lastDeployDate = getLastDeployDate()
7087

7188
return {
7289
props: {
7390
...(await serverSideTranslations(locale!, requiredNamespaces)),
7491
internalTutorials: getTutorialsData(locale!),
7592
locale,
76-
lastDeployDate
93+
lastDeployDate,
7794
},
7895
}
79-
}) satisfies GetStaticProps<SSRConfig>
96+
}) satisfies GetStaticProps<Props>
8097

8198
export interface IExternalTutorial {
8299
url: string
@@ -113,7 +130,10 @@ const published = (locale: string, published: string) => {
113130
) : null
114131
}
115132

116-
const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType<typeof getStaticProps>) => {
133+
const TutorialPage = ({
134+
internalTutorials,
135+
locale,
136+
}: InferGetServerSidePropsType<typeof getStaticProps>) => {
117137
const tableBoxShadow = useToken("colors", "tableBoxShadow")
118138
const cardBoxShadow = useToken("colors", "cardBoxShadow")
119139
const filteredTutorialsByLang = useMemo(
@@ -184,7 +204,9 @@ const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType
184204
>
185205
<PageMetadata
186206
title={t("page-developers-tutorials:page-tutorials-meta-title")}
187-
description={t("page-developers-tutorials:page-tutorials-meta-description")}
207+
description={t(
208+
"page-developers-tutorials:page-tutorials-meta-description"
209+
)}
188210
/>
189211
<Heading
190212
fontStyle="normal"

0 commit comments

Comments
 (0)