-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c56613d
commit 937b1db
Showing
5 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { defineField } from 'sanity'; | ||
import sectionId from '../ui/sectionId'; | ||
import { toPlainText } from '../../utils/to-plain-text'; | ||
|
||
const name = 'TagsSection'; | ||
const title = 'Tags Section'; | ||
const icon = () => '🏷️'; | ||
|
||
export default defineField({ | ||
name, | ||
type: 'object', | ||
title, | ||
icon, | ||
fields: [ | ||
defineField({ | ||
name: 'heading', | ||
type: 'Heading', | ||
title: 'Heading', | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'largeText', | ||
type: 'PortableText', | ||
title: 'Large Text', | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'paragraph', | ||
type: 'PortableText', | ||
title: 'Paragraph', | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'tagsHeading', | ||
type: 'Heading', | ||
title: 'Tags Heading', | ||
validation: Rule => Rule.required(), | ||
}), | ||
defineField({ | ||
name: 'tags', | ||
type: 'array', | ||
title: 'Tags', | ||
of: [{ type: 'string' }], | ||
validation: Rule => Rule.required(), | ||
}), | ||
...sectionId, | ||
], | ||
preview: { | ||
select: { | ||
heading: 'heading', | ||
}, | ||
prepare: ({ heading }) => ({ | ||
title: title, | ||
subtitle: toPlainText(heading), | ||
}), | ||
}, | ||
}); |
Binary file not shown.