Files
next.js/examples/cms-sanity/sanity/schemas/documents/author.ts
d45fc5ad95 examples: fix typos (#82506)
## Summary

Fix typos in code, styles, and documentation across multiple example
projects

Chores:
- Correct variable name typo in the with-slate example
(edtorState→editorState)
- Fix CSS/SASS class name misspellings (populer→popular, Serach→Search,
serachSelector→searchSelector)
- Update example documentation and comments to fix English typos (Data
SOUCE→SOURCE, accessiblity→accessibility, exchanges, doesn't, deploying,
validates, quickly)

### Adding or Updating Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

Co-authored-by: Joseph <[email protected]>
2025-11-24 14:04:41 +01:00

46 lines
1.0 KiB
TypeScript

import { UserIcon } from "@sanity/icons";
import { defineField, defineType } from "sanity";
export default defineType({
name: "author",
title: "Author",
icon: UserIcon,
type: "document",
fields: [
defineField({
name: "name",
title: "Name",
type: "string",
validation: (rule) => rule.required(),
}),
defineField({
name: "picture",
title: "Picture",
type: "image",
fields: [
{
name: "alt",
type: "string",
title: "Alternative text",
description: "Important for SEO and accessibility.",
validation: (rule) => {
return rule.custom((alt, context) => {
if ((context.document?.picture as any)?.asset?._ref && !alt) {
return "Required";
}
return true;
});
},
},
],
options: {
hotspot: true,
aiAssist: {
imageDescriptionField: "alt",
},
},
validation: (rule) => rule.required(),
}),
],
});