From a72ecc53d1e77f722c9b843f5ad932d2b07bc8e3 Mon Sep 17 00:00:00 2001 From: Giacomo Baggio Date: Tue, 3 Aug 2021 08:38:17 +0200 Subject: [PATCH] Merge branch 'v3' into about-us-section --- .../components/section/about-us-section.json | 8 +- frontend/features/page/index.ts | 8 +- .../blocks}/AboutUsSectionBlock.tsx | 16 +- frontend/features/pageBlocks/index.ts | 15 +- frontend/graphql.schema.json | 215 ++++++++++++++++++ frontend/graphql/GetPages.graphql | 1 + frontend/graphql/generated.ts | 39 +++- frontend/pages/[[...slug]].tsx | 1 + frontend/plugins/usePagePlugin.ts | 1 + 9 files changed, 289 insertions(+), 15 deletions(-) rename frontend/features/{pageBlocks => page/sections/AboutUsSection/blocks}/AboutUsSectionBlock.tsx (89%) diff --git a/backend/components/section/about-us-section.json b/backend/components/section/about-us-section.json index 9fac2993..69b30ed0 100644 --- a/backend/components/section/about-us-section.json +++ b/backend/components/section/about-us-section.json @@ -2,19 +2,21 @@ "collectionName": "components_section_about_us_sections", "info": { "name": "aboutUsSection", - "icon": "ambulance", - "description": "" + "icon": "angle-double-right" }, "options": {}, "attributes": { "sectionTitle": { "type": "string" }, + "sectionTitleColor": { + "type": "string" + }, "title": { "type": "string" }, "subtitle": { - "type": "richtext" + "type": "string" } } } diff --git a/frontend/features/page/index.ts b/frontend/features/page/index.ts index 9a862f19..d7954eb9 100644 --- a/frontend/features/page/index.ts +++ b/frontend/features/page/index.ts @@ -10,14 +10,20 @@ import { cardSectionBlock, CardSectionBlockData, } from "./sections/CardListSection/CardListSectionBlock"; +import { + AboutUsSectionBlockData, + aboutUsSectionBlock, +} from "./sections/AboutUsSection/blocks/AboutUsSectionBlock"; export const SECTION_PAGE_BLOCKS = { heroSection: heroSectionBlock, featureListSection: featureSectionBlock, cardListSection: cardSectionBlock, + aboutUsSection: aboutUsSectionBlock, }; export type SectionBlockData = | HeroSectionBlockData | FeatureListSectionBlockData - | CardSectionBlockData; + | CardSectionBlockData + | AboutUsSectionBlockData; diff --git a/frontend/features/pageBlocks/AboutUsSectionBlock.tsx b/frontend/features/page/sections/AboutUsSection/blocks/AboutUsSectionBlock.tsx similarity index 89% rename from frontend/features/pageBlocks/AboutUsSectionBlock.tsx rename to frontend/features/page/sections/AboutUsSection/blocks/AboutUsSectionBlock.tsx index 5bf139d8..0ea55d1b 100644 --- a/frontend/features/pageBlocks/AboutUsSectionBlock.tsx +++ b/frontend/features/page/sections/AboutUsSection/blocks/AboutUsSectionBlock.tsx @@ -6,13 +6,13 @@ import { BlocksControls, InlineTextarea, } from "react-tinacms-inline"; -import { BlockTemplateData } from "./types"; export type AboutUsSectionBlockData = BlockTemplateData< "aboutUsSection", { id: string; sectionTitle: Nullable; + sectionTitleColor: Nullable; title: Nullable; subtitle: Nullable; } @@ -20,12 +20,14 @@ export type AboutUsSectionBlockData = BlockTemplateData< interface AboutUsSectionBlockProps { sectionTitle: string; + sectionTitleColor: string; } const StyledInlineTextarea = chakra(InlineTextarea); export function AboutUsSectionBlock({ sectionTitle, + sectionTitleColor, }: AboutUsSectionBlockProps) { return ( @@ -45,7 +47,7 @@ export function AboutUsSectionBlock({ pos="relative" letterSpacing="0.02em"> @@ -126,6 +128,12 @@ export const aboutUsSectionBlock: Block = { subtitle: "Default subtitle", sectionTitle: "Default section title", }, - fields: [], + fields: [ + { + name: "sectionTitleColor", + component: "color", + label: "Section title color", + }, + ], }, }; diff --git a/frontend/features/pageBlocks/index.ts b/frontend/features/pageBlocks/index.ts index b44c9ac8..9e97d0a4 100644 --- a/frontend/features/pageBlocks/index.ts +++ b/frontend/features/pageBlocks/index.ts @@ -1,14 +1,19 @@ -export * from "./types"; -import { heroSectionBlock, HeroSectionBlockData } from "./HeroSectionBlock"; +import { + cardSectionBlock, + CardSectionBlockData, +} from "@features/page/sections/CardListSection/CardListSectionBlock"; import { featureSectionBlock, FeatureListSectionBlockData, -} from "./FeatureListSectionBlock"; -import { cardSectionBlock, CardSectionBlockData } from "./CardListSectionBlock"; +} from "@features/page/sections/FeatureListSection/FeatureListSectionBlock"; +import { + heroSectionBlock, + HeroSectionBlockData, +} from "@features/page/sections/HeroSection/HeroSectionBlock"; import { aboutUsSectionBlock, AboutUsSectionBlockData, -} from "./AboutUsSectionBlock"; +} from "../page/sections/AboutUsSection/blocks/AboutUsSectionBlock"; export const PAGE_SECTION_BLOCKS = { heroSection: heroSectionBlock, diff --git a/frontend/graphql.schema.json b/frontend/graphql.schema.json index c4568004..ede5ab9c 100644 --- a/frontend/graphql.schema.json +++ b/frontend/graphql.schema.json @@ -831,6 +831,140 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "ComponentSectionAboutUsSection", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sectionTitle", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sectionTitleColor", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subtitle", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ComponentSectionAboutUsSectionInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "sectionTitle", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sectionTitleColor", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subtitle", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "ComponentSectionCardSection", @@ -3134,6 +3268,11 @@ "name": "ComponentMenuPageLink", "ofType": null }, + { + "kind": "OBJECT", + "name": "ComponentSectionAboutUsSection", + "ofType": null + }, { "kind": "OBJECT", "name": "ComponentSectionCardSection", @@ -4837,6 +4976,11 @@ "kind": "OBJECT", "name": "ComponentSectionSingleFeatureSection", "ofType": null + }, + { + "kind": "OBJECT", + "name": "ComponentSectionAboutUsSection", + "ofType": null } ] }, @@ -10046,6 +10190,77 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "editComponentSectionAboutUsSectionInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "id", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sectionTitle", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sectionTitleColor", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subtitle", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "editComponentSectionCardSectionInput", diff --git a/frontend/graphql/GetPages.graphql b/frontend/graphql/GetPages.graphql index a4aecdc4..f28dbe13 100644 --- a/frontend/graphql/GetPages.graphql +++ b/frontend/graphql/GetPages.graphql @@ -65,6 +65,7 @@ query GetPages($where: JSON, $locale: String) { __typename id sectionTitle + sectionTitleColor title subtitle } diff --git a/frontend/graphql/generated.ts b/frontend/graphql/generated.ts index d5c51729..d6f7c1d7 100644 --- a/frontend/graphql/generated.ts +++ b/frontend/graphql/generated.ts @@ -117,6 +117,22 @@ export type ComponentMenuPageLinkInput = { link?: Maybe; }; +export type ComponentSectionAboutUsSection = { + __typename?: 'ComponentSectionAboutUsSection'; + id: Scalars['ID']; + sectionTitle?: Maybe; + sectionTitleColor?: Maybe; + title?: Maybe; + subtitle?: Maybe; +}; + +export type ComponentSectionAboutUsSectionInput = { + sectionTitle?: Maybe; + sectionTitleColor?: Maybe; + title?: Maybe; + subtitle?: Maybe; +}; + export type ComponentSectionCardSection = { __typename?: 'ComponentSectionCardSection'; id: Scalars['ID']; @@ -330,7 +346,7 @@ export type MenuInput = { updated_by?: Maybe; }; -export type Morph = UsersPermissionsMe | UsersPermissionsMeRole | UsersPermissionsLoginPayload | UserPermissionsPasswordPayload | Global | UpdateGlobalPayload | DeleteGlobalPayload | Menu | MenuConnection | MenuAggregator | MenuGroupBy | MenuConnectionId | MenuConnectionCreated_At | MenuConnectionUpdated_At | MenuConnectionTitle | MenuConnectionPublished_At | CreateMenuPayload | UpdateMenuPayload | DeleteMenuPayload | Pages | PagesConnection | PagesAggregator | PagesGroupBy | PagesConnectionId | PagesConnectionCreated_At | PagesConnectionUpdated_At | PagesConnectionTitle | PagesConnectionPath | PagesConnectionLocale | PagesConnectionPublished_At | CreatePagePayload | UpdatePagePayload | DeletePagePayload | I18NLocale | UploadFile | UploadFileConnection | UploadFileAggregator | UploadFileAggregatorSum | UploadFileAggregatorAvg | UploadFileAggregatorMin | UploadFileAggregatorMax | UploadFileGroupBy | UploadFileConnectionId | UploadFileConnectionCreated_At | UploadFileConnectionUpdated_At | UploadFileConnectionName | UploadFileConnectionAlternativeText | UploadFileConnectionCaption | UploadFileConnectionWidth | UploadFileConnectionHeight | UploadFileConnectionFormats | UploadFileConnectionHash | UploadFileConnectionExt | UploadFileConnectionMime | UploadFileConnectionSize | UploadFileConnectionUrl | UploadFileConnectionPreviewUrl | UploadFileConnectionProvider | UploadFileConnectionProvider_Metadata | DeleteFilePayload | UsersPermissionsPermission | UsersPermissionsRole | UsersPermissionsRoleConnection | UsersPermissionsRoleAggregator | UsersPermissionsRoleGroupBy | UsersPermissionsRoleConnectionId | UsersPermissionsRoleConnectionName | UsersPermissionsRoleConnectionDescription | UsersPermissionsRoleConnectionType | CreateRolePayload | UpdateRolePayload | DeleteRolePayload | UsersPermissionsUser | UsersPermissionsUserConnection | UsersPermissionsUserAggregator | UsersPermissionsUserGroupBy | UsersPermissionsUserConnectionId | UsersPermissionsUserConnectionCreated_At | UsersPermissionsUserConnectionUpdated_At | UsersPermissionsUserConnectionUsername | UsersPermissionsUserConnectionEmail | UsersPermissionsUserConnectionProvider | UsersPermissionsUserConnectionConfirmed | UsersPermissionsUserConnectionBlocked | UsersPermissionsUserConnectionRole | CreateUserPayload | UpdateUserPayload | DeleteUserPayload | ComponentBlocksCard | ComponentBlocksHero | ComponentBlocksNavigationBlock | ComponentBlocksSingleFeature | ComponentGlobalTopbar | ComponentMenuPageLink | ComponentSectionCardSection | ComponentSectionFooterSection | ComponentSectionHeroSection | ComponentSectionNavigationSection | ComponentSectionSingleFeatureSection; +export type Morph = UsersPermissionsMe | UsersPermissionsMeRole | UsersPermissionsLoginPayload | UserPermissionsPasswordPayload | Global | UpdateGlobalPayload | DeleteGlobalPayload | Menu | MenuConnection | MenuAggregator | MenuGroupBy | MenuConnectionId | MenuConnectionCreated_At | MenuConnectionUpdated_At | MenuConnectionTitle | MenuConnectionPublished_At | CreateMenuPayload | UpdateMenuPayload | DeleteMenuPayload | Pages | PagesConnection | PagesAggregator | PagesGroupBy | PagesConnectionId | PagesConnectionCreated_At | PagesConnectionUpdated_At | PagesConnectionTitle | PagesConnectionPath | PagesConnectionLocale | PagesConnectionPublished_At | CreatePagePayload | UpdatePagePayload | DeletePagePayload | I18NLocale | UploadFile | UploadFileConnection | UploadFileAggregator | UploadFileAggregatorSum | UploadFileAggregatorAvg | UploadFileAggregatorMin | UploadFileAggregatorMax | UploadFileGroupBy | UploadFileConnectionId | UploadFileConnectionCreated_At | UploadFileConnectionUpdated_At | UploadFileConnectionName | UploadFileConnectionAlternativeText | UploadFileConnectionCaption | UploadFileConnectionWidth | UploadFileConnectionHeight | UploadFileConnectionFormats | UploadFileConnectionHash | UploadFileConnectionExt | UploadFileConnectionMime | UploadFileConnectionSize | UploadFileConnectionUrl | UploadFileConnectionPreviewUrl | UploadFileConnectionProvider | UploadFileConnectionProvider_Metadata | DeleteFilePayload | UsersPermissionsPermission | UsersPermissionsRole | UsersPermissionsRoleConnection | UsersPermissionsRoleAggregator | UsersPermissionsRoleGroupBy | UsersPermissionsRoleConnectionId | UsersPermissionsRoleConnectionName | UsersPermissionsRoleConnectionDescription | UsersPermissionsRoleConnectionType | CreateRolePayload | UpdateRolePayload | DeleteRolePayload | UsersPermissionsUser | UsersPermissionsUserConnection | UsersPermissionsUserAggregator | UsersPermissionsUserGroupBy | UsersPermissionsUserConnectionId | UsersPermissionsUserConnectionCreated_At | UsersPermissionsUserConnectionUpdated_At | UsersPermissionsUserConnectionUsername | UsersPermissionsUserConnectionEmail | UsersPermissionsUserConnectionProvider | UsersPermissionsUserConnectionConfirmed | UsersPermissionsUserConnectionBlocked | UsersPermissionsUserConnectionRole | CreateUserPayload | UpdateUserPayload | DeleteUserPayload | ComponentBlocksCard | ComponentBlocksHero | ComponentBlocksNavigationBlock | ComponentBlocksSingleFeature | ComponentGlobalTopbar | ComponentMenuPageLink | ComponentSectionAboutUsSection | ComponentSectionCardSection | ComponentSectionFooterSection | ComponentSectionHeroSection | ComponentSectionNavigationSection | ComponentSectionSingleFeatureSection; export type Mutation = { __typename?: 'Mutation'; @@ -604,7 +620,7 @@ export type PagesGroupBy = { published_at?: Maybe>>; }; -export type PagesSectionsDynamicZone = ComponentSectionCardSection | ComponentSectionHeroSection | ComponentSectionSingleFeatureSection; +export type PagesSectionsDynamicZone = ComponentSectionCardSection | ComponentSectionHeroSection | ComponentSectionSingleFeatureSection | ComponentSectionAboutUsSection; export enum PublicationState { @@ -1318,6 +1334,14 @@ export type EditComponentMenuPageLinkInput = { link?: Maybe; }; +export type EditComponentSectionAboutUsSectionInput = { + id?: Maybe; + sectionTitle?: Maybe; + sectionTitleColor?: Maybe; + title?: Maybe; + subtitle?: Maybe; +}; + export type EditComponentSectionCardSectionInput = { id?: Maybe; title?: Maybe; @@ -1517,6 +1541,9 @@ export type GetPagesQuery = ( & Pick )> } )>>> } + ) | ( + { __typename: 'ComponentSectionAboutUsSection' } + & Pick )>>> } )>>> } ); @@ -1664,6 +1691,14 @@ export const GetPages = ` label } } + ... on ComponentSectionAboutUsSection { + __typename + id + sectionTitle + sectionTitleColor + title + subtitle + } } } } diff --git a/frontend/pages/[[...slug]].tsx b/frontend/pages/[[...slug]].tsx index d758110e..5b012643 100644 --- a/frontend/pages/[[...slug]].tsx +++ b/frontend/pages/[[...slug]].tsx @@ -374,6 +374,7 @@ function getPageData( title: section.title || null, subtitle: section.subtitle || null, sectionTitle: section.sectionTitle || null, + sectionTitleColor: section.sectionTitleColor || null, }; } default: diff --git a/frontend/plugins/usePagePlugin.ts b/frontend/plugins/usePagePlugin.ts index 4510ecdb..584e0d85 100644 --- a/frontend/plugins/usePagePlugin.ts +++ b/frontend/plugins/usePagePlugin.ts @@ -182,6 +182,7 @@ function getPageInput(data: PageData): UpdatePageInput { __typename: "ComponentSectionAboutUsSection", id: section.id, sectionTitle: section.sectionTitle, + sectionTitleColor: section.sectionTitleColor, title: section.title, subtitle: section.subtitle, };