Linted the whole project with eslint
This commit was merged in pull request #3.
This commit is contained in:
38
pages/404.js
38
pages/404.js
@@ -2,23 +2,23 @@ import { Hero } from "../components/blocks/hero";
|
||||
import { Layout } from "../components/layout";
|
||||
|
||||
export default function FourOhFour() {
|
||||
return (
|
||||
<Layout>
|
||||
<Hero
|
||||
data={{
|
||||
color: "default",
|
||||
headline: "404 – Page Not Found",
|
||||
text: "Oops! It seems there's nothing here, how embarrassing.",
|
||||
actions: [
|
||||
{
|
||||
label: "Return Home",
|
||||
type: "button",
|
||||
icon: true,
|
||||
link: "/",
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</Layout>
|
||||
);
|
||||
return (
|
||||
<Layout>
|
||||
<Hero
|
||||
data={ {
|
||||
color: "default",
|
||||
headline: "404 – Page Not Found",
|
||||
text: "Oops! It seems there's nothing here, how embarrassing.",
|
||||
actions: [
|
||||
{
|
||||
label: "Return Home",
|
||||
type: "button",
|
||||
icon: true,
|
||||
link: "/"
|
||||
}
|
||||
]
|
||||
} }
|
||||
/>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,36 +6,36 @@ import { Layout } from "../components/layout";
|
||||
import { client } from "../tina/__generated__/client";
|
||||
|
||||
export default function HomePage(
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
) {
|
||||
const { data } = useTina(props);
|
||||
const { data } = useTina(props);
|
||||
|
||||
return (
|
||||
<Layout rawData={data} data={data.global as any}>
|
||||
<Blocks {...data.page} />
|
||||
</Layout>
|
||||
);
|
||||
return (
|
||||
<Layout rawData={ data } data={ data.global as any }>
|
||||
<Blocks { ...data.page } />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getStaticProps = async ({ params }) => {
|
||||
const tinaProps = await client.queries.contentQuery({
|
||||
relativePath: `${params.filename}.md`,
|
||||
});
|
||||
const props = {
|
||||
...tinaProps,
|
||||
enableVisualEditing: process.env.VERCEL_ENV === "preview",
|
||||
};
|
||||
return {
|
||||
props: JSON.parse(JSON.stringify(props)) as typeof props,
|
||||
};
|
||||
const tinaProps = await client.queries.contentQuery({
|
||||
relativePath: `${ params.filename }.md`
|
||||
});
|
||||
const props = {
|
||||
...tinaProps,
|
||||
enableVisualEditing: process.env.VERCEL_ENV === "preview"
|
||||
};
|
||||
return {
|
||||
props: JSON.parse(JSON.stringify(props)) as typeof props
|
||||
};
|
||||
};
|
||||
|
||||
export const getStaticPaths = async () => {
|
||||
const pagesListData = await client.queries.pageConnection();
|
||||
return {
|
||||
paths: pagesListData.data.pageConnection?.edges?.map((page) => ({
|
||||
params: { filename: page?.node?._sys.filename },
|
||||
})),
|
||||
fallback: false,
|
||||
};
|
||||
const pagesListData = await client.queries.pageConnection();
|
||||
return {
|
||||
paths: pagesListData.data.pageConnection?.edges?.map((page) => ({
|
||||
params: { filename: page?.node?._sys.filename }
|
||||
})),
|
||||
fallback: false
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "../styles/_styles.scss";
|
||||
|
||||
const App = ({ Component, pageProps }) => {
|
||||
return <Component {...pageProps} />;
|
||||
return <Component { ...pageProps } />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
@@ -6,28 +6,28 @@ import { Layout } from "../components/layout";
|
||||
import { InferGetStaticPropsType } from "next";
|
||||
|
||||
export default function HomePage(
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
) {
|
||||
const posts = props.data.postConnection.edges;
|
||||
const posts = props.data.postConnection.edges;
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Section className="flex-1">
|
||||
<Container size="large" width="small">
|
||||
<Posts data={posts} />
|
||||
</Container>
|
||||
</Section>
|
||||
</Layout>
|
||||
);
|
||||
return (
|
||||
<Layout>
|
||||
<Section className="flex-1">
|
||||
<Container size="large" width="small">
|
||||
<Posts data={ posts } />
|
||||
</Container>
|
||||
</Section>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
const tinaProps = await client.queries.pageQuery();
|
||||
return {
|
||||
props: {
|
||||
...tinaProps,
|
||||
},
|
||||
};
|
||||
const tinaProps = await client.queries.pageQuery();
|
||||
return {
|
||||
props: {
|
||||
...tinaProps
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export type PostsType = InferGetStaticPropsType<
|
||||
|
||||
@@ -6,36 +6,36 @@ import { InferGetStaticPropsType } from "next";
|
||||
|
||||
// Use the props returned by get static props
|
||||
export default function BlogPostPage(
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
props: InferGetStaticPropsType<typeof getStaticProps>
|
||||
) {
|
||||
const { data } = useTina({
|
||||
query: props.query,
|
||||
variables: props.variables,
|
||||
data: props.data,
|
||||
});
|
||||
if (data && data.post) {
|
||||
const { data } = useTina({
|
||||
query: props.query,
|
||||
variables: props.variables,
|
||||
data: props.data
|
||||
});
|
||||
if (data && data.post) {
|
||||
return (
|
||||
<Layout rawData={ data } data={ data.global }>
|
||||
<Post { ...data.post } />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Layout rawData={data} data={data.global}>
|
||||
<Post {...data.post} />
|
||||
</Layout>
|
||||
<Layout>
|
||||
<div>No data</div>;
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Layout>
|
||||
<div>No data</div>;
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getStaticProps = async ({ params }) => {
|
||||
const tinaProps = await client.queries.blogPostQuery({
|
||||
relativePath: `${params.filename}.mdx`,
|
||||
});
|
||||
return {
|
||||
props: {
|
||||
...tinaProps,
|
||||
},
|
||||
};
|
||||
const tinaProps = await client.queries.blogPostQuery({
|
||||
relativePath: `${ params.filename }.mdx`
|
||||
});
|
||||
return {
|
||||
props: {
|
||||
...tinaProps
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -46,13 +46,13 @@ export const getStaticProps = async ({ params }) => {
|
||||
* be viewable at http://localhost:3000/posts/hello
|
||||
*/
|
||||
export const getStaticPaths = async () => {
|
||||
const postsListData = await client.queries.postConnection();
|
||||
return {
|
||||
paths: postsListData.data.postConnection.edges.map((post) => ({
|
||||
params: { filename: post.node._sys.filename },
|
||||
})),
|
||||
fallback: "blocking",
|
||||
};
|
||||
const postsListData = await client.queries.postConnection();
|
||||
return {
|
||||
paths: postsListData.data.postConnection.edges.map((post) => ({
|
||||
params: { filename: post.node._sys.filename }
|
||||
})),
|
||||
fallback: "blocking"
|
||||
};
|
||||
};
|
||||
|
||||
export type PostType = InferGetStaticPropsType<
|
||||
|
||||
Reference in New Issue
Block a user