Skip to content

Commit

Permalink
Merge pull request #17 from AAStarCommunity/dev
Browse files Browse the repository at this point in the history
fixed index
  • Loading branch information
superwunc authored Jun 27, 2024
2 parents 8df0fd8 + 0a7809c commit 52e581d
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 52e581d

Please sign in to comment.