Skip to content

Commit

Permalink
Merge branch 'padms/1887' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Nov 14, 2023
2 parents 5c270c1 + 5d467f2 commit bd7f2e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sanityv3/schemas/documents/header/sharedHeaderFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const heroBigTitleDefault = {
hidden: ({ parent }: DocumentType) => !parent.isBigTitle || parent.heroType !== HeroTypes.DEFAULT,
validation: (Rule: Rule) =>
Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
blocksToText(value)?.length === 0 &&
(!value || blocksToText(value)?.length === 0) &&
(ctx.parent as Hero)?.isBigTitle &&
(ctx.parent as Hero)?.heroType === HeroTypes.DEFAULT
? 'Title is required'
Expand Down Expand Up @@ -147,7 +147,7 @@ const heroTitle = {
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.FIFTY_FIFTY && !value) return 'Field is required'
if (parent?.heroType === HeroTypes.FIFTY_FIFTY && !value && !parent.isBigTitle) return 'Field is required'
return true
}),
}
Expand Down

0 comments on commit bd7f2e9

Please sign in to comment.