Skip to content

Commit

Permalink
fixed index
Browse files Browse the repository at this point in the history
  • Loading branch information
superwunc committed Jun 27, 2024
1 parent 26566c8 commit 0a7809c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import { InferGetStaticPropsType } from "next";
import { Blocks } from "../components/blocks-renderer";
import { useTina } from "tinacms/dist/react";
import { Layout } from "../components/layout";
import { client } from "../tina/__generated__/client";

export default function HomePage(
props: InferGetStaticPropsType<typeof getStaticProps>
) {
const { data } = useTina(props);

return (
<Layout rawData={data} data={data.global as any}>
<Blocks {...data.page} />
</Layout>
);
}

export const getStaticProps = async () => {
const tinaProps = await client.queries.contentQuery({
relativePath: `home.md`,
});
const props = {
...tinaProps,
enableVisualEditing: process.env.VERCEL_ENV === "preview",
};
return {
props: JSON.parse(JSON.stringify(props)) as typeof props,
};
};

0 comments on commit 0a7809c

Please sign in to comment.