Skip to content

Commit

Permalink
fix: allow assets without files for preview
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed May 24, 2022
1 parent b591950 commit bdfcdd4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Ignored if layout = FLUID.",
},
},
"resolve": [Function],
"type": "JSON!",
"type": "JSON",
},
"height": Object {
"type": "Int",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,33 @@ export async function createSchemaCustomization(
)

// Assets
const gatsbyImageData = getGatsbyImageFieldConfig(
async (...args) => resolveGatsbyImageData(...args, { cache }),
{
jpegProgressive: {
type: `Boolean`,
defaultValue: true,
},
resizingBehavior: {
type: ImageResizingBehavior,
},
cropFocus: {
type: ImageCropFocusType,
},
cornerRadius: {
type: `Int`,
defaultValue: 0,
description: stripIndent`
Desired corner radius in pixels. Results in an image with rounded corners.
Pass \`-1\` for a full circle/ellipse.`,
},
quality: {
type: `Int`,
defaultValue: 50,
},
}
)
gatsbyImageData.type = `JSON`
createTypes(
addRemoteFilePolyfillInterface(
schema.buildObjectType({
Expand All @@ -334,32 +361,7 @@ export async function createSchemaCustomization(
id: { type: `ID!` },
sys: { type: `ContentfulSys!` },
metadata: { type: `ContentfulMetadata!` },
gatsbyImageData: getGatsbyImageFieldConfig(
async (...args) => resolveGatsbyImageData(...args, { cache }),
{
jpegProgressive: {
type: `Boolean`,
defaultValue: true,
},
resizingBehavior: {
type: ImageResizingBehavior,
},
cropFocus: {
type: ImageCropFocusType,
},
cornerRadius: {
type: `Int`,
defaultValue: 0,
description: stripIndent`
Desired corner radius in pixels. Results in an image with rounded corners.
Pass \`-1\` for a full circle/ellipse.`,
},
quality: {
type: `Int`,
defaultValue: 50,
},
}
),
gatsbyImageData,
...(pluginConfig.get(`downloadLocal`)
? {
localFile: {
Expand Down

0 comments on commit bdfcdd4

Please sign in to comment.