Skip to content

Commit

Permalink
add TwoColumnTextWithTags section schema
Browse files Browse the repository at this point in the history
  • Loading branch information
milewskibogumil committed Oct 16, 2024
1 parent 43b0243 commit 3c4c465
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/sanity/schema/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MetricsSection from "./components/MetricsSection";
import Faq from "./components/Faq";
import IconGridWithCtaSection from "./components/IconGridWithCtaSection";
import BorderedFullImage from "./components/BorderedFullImage";
import TwoColumnTextWithTags from "./components/TwoColumnTextWithTags";

export default defineType({
name: 'components',
Expand All @@ -25,6 +26,7 @@ export default defineType({
Faq,
IconGridWithCtaSection,
BorderedFullImage,
TwoColumnTextWithTags,
],
options: {
insertMenu: {
Expand Down
58 changes: 58 additions & 0 deletions apps/sanity/schema/components/TwoColumnTextWithTags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { defineField } from 'sanity';
import { toPlainText } from '../../utils/to-plain-text';

const name = 'TwoColumnTextWithTags';
const title = 'Sekcja Kolumnowa z Tagami';
const icon = () => '🏛️';

export default defineField({
name,
type: 'object',
title,
icon,
fields: [
defineField({
name: 'heading',
type: 'Heading',
title: 'Nagłówek',
validation: Rule => Rule.required(),
}),
defineField({
name: 'paragraph',
type: 'PortableText',
title: 'Paragraf',
validation: Rule => Rule.required(),
}),
defineField({
name: 'headingSecondary',
type: 'PortableText',
title: 'Drugi Nagłówek',
validation: Rule => Rule.required(),
}),
defineField({
name: 'tags',
type: 'array',
of: [{ type: 'string' }],
title: 'Tagi',
validation: Rule => Rule.required(),
}),
defineField({
name: 'paragraphSecondary',
type: 'PortableText',
title: 'Drugi Paragraf',
validation: Rule => Rule.required(),
}),
],
preview: {
select: {
heading: 'heading',
media: 'img',
},
prepare: ({ heading, media }) => ({
title: title,
subtitle: toPlainText(heading),
media,
icon,
}),
},
});
Binary file added apps/sanity/static/TwoColumnTextWithTags.webp
Binary file not shown.

0 comments on commit 3c4c465

Please sign in to comment.