1
0
Fork 0

feat: add training list page, training page and markdown content

This commit is contained in:
Vojtěch Mareš 2022-12-19 00:04:15 +01:00
parent 3dd584fcf4
commit e19dbb71cd
16 changed files with 586 additions and 15 deletions

View file

@ -2,8 +2,36 @@ import Head from "next/head";
import { Header } from "@/components/Header"
import { Footer } from '@/components/Footer'
import { getAllTraining } from "@/lib/cms/training";
import TrainingType from "@/types/training";
import { TrainingListGrid } from "@/components/TrainingListGrid";
export const getStaticProps = async () => {
const allTraining = getAllTraining([
'name',
'slug',
'logo',
'description',
'days',
'weight',
'featured',
'new',
'draft',
])
return {
props: { allTraining },
}
}
type Props = {
allTraining: TrainingType[]
}
const TrainingList = ({ allTraining }: Props) => {
// remove drafts
const trainingList = allTraining.filter((val) => !val.draft)
export default function Home() {
return (
<>
<Head>
@ -16,9 +44,11 @@ export default function Home() {
</Head>
<main>
<Header />
<h1 className="text-4xl mx-auto w-12 my-8">Připravuji</h1>
<TrainingListGrid trainingList={trainingList} />
</main>
<Footer />
</>
);
}
export default TrainingList