Skip to content

Commit

Permalink
feat: add BuyModal and BuyModalOptions documents (#27)
Browse files Browse the repository at this point in the history
* feat: add BuyModal and BuyModalOptions documents

* fix: comment create action
  • Loading branch information
flagrede authored Feb 28, 2023
1 parent 0b9210c commit ce1971a
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 1 deletion.
8 changes: 8 additions & 0 deletions deskStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ export default () => {
.title('Basket Details Page')
.schemaType('basketDetailsPage')
.child(S.document().schemaType('basketDetailsPage')),
S.listItem()
.title('Buy Modal Options')
.schemaType('buyModalOptions')
.child(S.document().schemaType('buyModalOptions')),
S.listItem()
.title('Buy Modal')
.schemaType('buyModal')
.child(S.document().schemaType('buyModal')),
]),
),

Expand Down
15 changes: 15 additions & 0 deletions schemas/documents/registry/buyModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default {
type: 'document',
name: 'buyModal',
title: 'Buy Modal',
__experimental_actions: ['update', /* 'create', 'delete', */ 'publish'],
fields: [
{
title: 'Info card',
name: 'infoCard',
type: 'infoCard',
description: 'Create the card to be displayed at the top of the buy modal',
validation: Rule => Rule.required(),
},
],
};
27 changes: 27 additions & 0 deletions schemas/documents/registry/buyModalOptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default {
type: 'document',
name: 'buyModalOptions',
title: 'Buy Modal Options',
__experimental_actions: ['update', /* 'create', 'delete', */ 'publish'],
fields: [
{
title: 'Title',
name: 'title',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Buy Options Cards',
name: 'cards',
type: 'array',
description:
'Create one or several cards (min 1), to be displayed when clicking a buy button for a non-connected user',
of: [
{
type: 'actionCard',
},
],
validation: Rule => Rule.required().min(1),
},
],
};
36 changes: 36 additions & 0 deletions schemas/objects/cards/actionCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export default {
name: 'actionCard',
type: 'object',
title: 'ActionCard',
fields: [
{
title: 'Title',
name: 'title',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Description',
name: 'description',
type: 'customPortableText',
validation: Rule => Rule.required(),
},
{
title: 'Button',
name: 'button',
type: 'button',
validation: Rule => Rule.required(),
},
{
title: 'Note',
name: 'note',
type: 'customPortableText',
},
{
title: 'Image',
name: 'image',
type: 'customImage',
validation: Rule => Rule.required(),
},
],
};
File renamed without changes.
25 changes: 25 additions & 0 deletions schemas/objects/cards/infoCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default {
name: 'infoCard',
type: 'object',
title: 'InfoCard',
fields: [
{
title: 'Title',
name: 'title',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Description',
name: 'description',
type: 'customPortableText',
validation: Rule => Rule.required(),
},
{
title: 'Image',
name: 'image',
type: 'customImage',
validation: Rule => Rule.required(),
},
],
};
10 changes: 9 additions & 1 deletion schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import projectsPage from './documents/registry/projectsPage';
import projectPage from './documents/registry/projectPage';
import bridgePage from './documents/registry/bridgePage';
import basketDetailsPage from './documents/registry/basketDetailsPage';
import buyModal from './documents/registry/buyModal';
import buyModalOptions from './documents/registry/buyModalOptions';

import resource from './documents/shared/resource';
import faq from './documents/shared/faq';
Expand Down Expand Up @@ -59,7 +61,7 @@ import imageGridSection from './objects/sections/imageGridSection';

import stepCard from './objects/stepCard';
import bottomBanner from './objects/bottomBanner';
import card from './objects/card';
import card from './objects/cards/card';
import pageMetadata from './objects/pageMetadata';
import customPortableText from './objects/customPortableText';
import button from './objects/button';
Expand Down Expand Up @@ -176,6 +178,8 @@ import creditInfos from './objects/creditInfos';
import buyersEcologicalCreditCardsSection from './objects/sections/buyersPage/ecologicalCreditCardsSection';
import buyersFeaturedProjectCardsSection from './objects/sections/buyersPage/featuredProjectCardsSection';
import buyersPartnersSection from './objects/sections/buyersPage/partnersSection';
import actionCard from './objects/cards/actionCard';
import infoCard from './objects/cards/infoCard';

// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
Expand All @@ -184,6 +188,7 @@ export default createSchema({
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
actionCard,
basicStepCardSection,
basketDetailsPage,
blogPost,
Expand All @@ -192,6 +197,8 @@ export default createSchema({
bottomBanner,
bridgePage,
button,
buyModal,
buyModalOptions,
buyer,
buyersPage,
buyersEcologicalCreditCardsSection,
Expand Down Expand Up @@ -269,6 +276,7 @@ export default createSchema({
imageItemsSection,
imageLink,
imageWithTitle,
infoCard,
labeledTextLinkable,
landManagementPractice,
landSteward,
Expand Down

0 comments on commit ce1971a

Please sign in to comment.