There was an error while loading. Please reload this page.
1 parent a5867d4 commit b760388Copy full SHA for b760388
1 file changed
studio/schemas/documents/header/sharedHeaderFields.ts
@@ -231,7 +231,13 @@ const backgroundGradient = {
231
{ title: 'Light', value: 'light' },
232
],
233
},
234
- validation: (Rule: Rule) => Rule.required(),
+ validation: (Rule: Rule) =>
235
+ Rule.custom((value: string, context: ValidationContext) => {
236
+ const { parent } = context as unknown as DocumentType
237
+ if (parent?.heroType === HeroTypes.BACKGROUND_IMAGE && !value)
238
+ return 'Field is required'
239
+ return true
240
+ }),
241
hidden: ({ parent }: DocumentType) => {
242
return parent?.heroType !== HeroTypes.BACKGROUND_IMAGE
243
}
0 commit comments