Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
dv297 committed Sep 22, 2022
1 parent c3e2664 commit 1966334
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 39 deletions.
3 changes: 2 additions & 1 deletion blog/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "@sanity/eslint-config-studio"
"extends": "@sanity/eslint-config-studio",
"root": true
}
4 changes: 1 addition & 3 deletions blog/sanity.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
"plugins": ["@sanity/vision"]
}
},
"parts": [
Expand Down
4 changes: 2 additions & 2 deletions blog/schemas/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
{
title: 'Block',
type: 'block',
styles: [{title: 'Normal', value: 'normal'}],
styles: [{ title: 'Normal', value: 'normal' }],
lists: [],
},
],
Expand All @@ -45,4 +45,4 @@ export default {
media: 'image',
},
},
}
};
22 changes: 11 additions & 11 deletions blog/schemas/blockContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ export default {
// you want and decide how you want to deal with it where you want to
// use your content.
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'Quote', value: 'blockquote'},
{ title: 'Normal', value: 'normal' },
{ title: 'H1', value: 'h1' },
{ title: 'H2', value: 'h2' },
{ title: 'H3', value: 'h3' },
{ title: 'H4', value: 'h4' },
{ title: 'Quote', value: 'blockquote' },
],
lists: [{title: 'Bullet', value: 'bullet'}],
lists: [{ title: 'Bullet', value: 'bullet' }],
// Marks let you mark up inline text in the block editor.
marks: {
// Decorators usually describe a single property – e.g. a typographic
// preference or highlighting by editors.
decorators: [
{title: 'Strong', value: 'strong'},
{title: 'Emphasis', value: 'em'},
{ title: 'Strong', value: 'strong' },
{ title: 'Emphasis', value: 'em' },
],
// Annotations can be any object structure – e.g. a link or a footnote.
annotations: [
Expand All @@ -59,7 +59,7 @@ export default {
// as a block type.
{
type: 'image',
options: {hotspot: true},
options: { hotspot: true },
},
],
}
};
2 changes: 1 addition & 1 deletion blog/schemas/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export default {
type: 'text',
},
],
}
};
10 changes: 5 additions & 5 deletions blog/schemas/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
name: 'author',
title: 'Author',
type: 'reference',
to: {type: 'author'},
to: { type: 'author' },
},
{
name: 'mainImage',
Expand All @@ -35,7 +35,7 @@ export default {
name: 'categories',
title: 'Categories',
type: 'array',
of: [{type: 'reference', to: {type: 'category'}}],
of: [{ type: 'reference', to: { type: 'category' } }],
},
{
name: 'publishedAt',
Expand All @@ -56,10 +56,10 @@ export default {
media: 'mainImage',
},
prepare(selection) {
const {author} = selection
const { author } = selection;
return Object.assign({}, selection, {
subtitle: author && `by ${author}`,
})
});
},
},
}
};
14 changes: 7 additions & 7 deletions blog/schemas/schema.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'
import createSchema from 'part:@sanity/base/schema-creator';

// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'
import schemaTypes from 'all:part:@sanity/base/schema-type';

// We import object and document schemas
import blockContent from './blockContent'
import category from './category'
import post from './post'
import author from './author'
import blockContent from './blockContent';
import category from './category';
import post from './post';
import author from './author';

// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
Expand All @@ -26,4 +26,4 @@ export default createSchema({
// { type: 'typename' } in other document schemas
blockContent,
]),
})
});
6 changes: 5 additions & 1 deletion blog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
// Note: This config is only used to help editors like VS Code understand/resolve
// parts, the actual transpilation is done by babel. Any compiler configuration in
// here will be ignored.
"include": ["./node_modules/@sanity/base/types/**/*.ts", "./**/*.ts", "./**/*.tsx"]
"include": [
"./node_modules/@sanity/base/types/**/*.ts",
"./**/*.ts",
"./**/*.tsx"
]
}
9 changes: 1 addition & 8 deletions src/pages/blog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import imageUrlBuilder from '@sanity/image-url';
import { useRouter } from 'next/router';
import { groq } from 'next-sanity';
import { ReactNode } from 'react';
Expand Down Expand Up @@ -44,7 +43,7 @@ const Posts = (props: any) => {
</div>
<div className="relative mx-auto max-w-7xl">
<div className="mx-auto mt-12 grid max-w-lg gap-5 lg:max-w-none lg:grid-cols-3">
{posts.map((post) => {
{posts.map((post: any) => {
return (
<BlogPostListing post={post} key={post.slug} preview={preview} />
);
Expand All @@ -55,15 +54,9 @@ const Posts = (props: any) => {
);
};

interface StaticPropsParams {
slug: string;
}

export async function getStaticProps({
params,
preview = false,
}: {
params: StaticPropsParams;
preview: boolean;
}) {
const posts = await getClient(preview).fetch(query);
Expand Down

0 comments on commit 1966334

Please sign in to comment.