-
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.
add TwoColumnTextWithTags section schema
- Loading branch information
1 parent
43b0243
commit 3c4c465
Showing
3 changed files
with
60 additions
and
0 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
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 not shown.