From 8f0bfe43ec71d27705022438856b0c9b9c334f3d Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 20 Dec 2024 11:22:29 +0100 Subject: [PATCH 1/5] remove callout --- README.md | 2 +- src/components/sections/callout/Callout.tsx | 33 ----------------- .../sections/callout/CalloutPreview.tsx | 37 ------------------- .../sections/callout/callout.module.css | 23 ------------ src/utils/renderSection.tsx | 23 ------------ studio/lib/interfaces/pages.ts | 8 ---- studio/lib/queries/pages.ts | 7 ---- studio/schemas/documents/pageBuilder.ts | 1 - studio/schemas/objects/sections/callout.ts | 34 ----------------- 9 files changed, 1 insertion(+), 167 deletions(-) delete mode 100644 src/components/sections/callout/Callout.tsx delete mode 100644 src/components/sections/callout/CalloutPreview.tsx delete mode 100644 src/components/sections/callout/callout.module.css delete mode 100644 studio/schemas/objects/sections/callout.ts diff --git a/README.md b/README.md index 07ee134bd..c7a15a6a9 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ The `Company Information` menu allows you to configure global settings for your ### Pages - **Creating Pages**: Content editors can create and manage pages under the `Pages` menu in the Sanity Studio. -- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, testimonials, features, callToAction, grid, and callout. +- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, testimonials, features, callToAction and grid. ## Development diff --git a/src/components/sections/callout/Callout.tsx b/src/components/sections/callout/Callout.tsx deleted file mode 100644 index 4bf164098..000000000 --- a/src/components/sections/callout/Callout.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { PortableText, PortableTextReactComponents } from "@portabletext/react"; - -import CustomLink from "src/components/link/CustomLink"; -import Text from "src/components/text/Text"; -import { CalloutSection } from "studio/lib/interfaces/pages"; - -import styles from "./callout.module.css"; - -interface CalloutProps { - callout: CalloutSection; -} - -const myPortableTextComponents: Partial = { - block: ({ children }) => {children}, -}; - -const Callout = ({ callout }: CalloutProps) => { - return ( - callout.richText && ( -
-
- - {callout.link && } -
-
- ) - ); -}; - -export default Callout; diff --git a/src/components/sections/callout/CalloutPreview.tsx b/src/components/sections/callout/CalloutPreview.tsx deleted file mode 100644 index a7bf6e3b0..000000000 --- a/src/components/sections/callout/CalloutPreview.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import { useQuery } from "@sanity/react-loader"; -import { Suspense } from "react"; - -import { PreviewProps } from "src/types/preview"; -import { CalloutSection, PageBuilder } from "studio/lib/interfaces/pages"; -import { PAGE_QUERY } from "studio/lib/queries/pages"; - -import Callout from "./Callout"; - -export default function CalloutPreview({ - initialData, - sectionIndex, -}: PreviewProps) { - const { data: newData } = useQuery( - PAGE_QUERY, - { id: initialData.data._id, language: initialData.data.language }, - { initial: initialData }, - ); - - const calloutSection = newData - ? (newData.sections.find( - (section, index) => - section._type === "callout" && index === sectionIndex, - ) as CalloutSection) - : (initialData.data.sections.find( - (section, index) => - section._type === "callout" && index === sectionIndex, - ) as CalloutSection); - - return ( - - - - ); -} diff --git a/src/components/sections/callout/callout.module.css b/src/components/sections/callout/callout.module.css deleted file mode 100644 index d601f45c1..000000000 --- a/src/components/sections/callout/callout.module.css +++ /dev/null @@ -1,23 +0,0 @@ -.shared { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -.callout { - composes: shared; - width: -webkit-fill-available; - max-width: 75rem; - gap: 3rem; - - padding: 5rem 2rem; - - @media (min-width: 640px) { - padding: 5rem 3rem; - } - - @media (min-width: 1024px) { - padding: 7.5rem; - } -} diff --git a/src/utils/renderSection.tsx b/src/utils/renderSection.tsx index 988675ccf..97255eb9d 100644 --- a/src/utils/renderSection.tsx +++ b/src/utils/renderSection.tsx @@ -2,8 +2,6 @@ import { QueryResponseInitial } from "@sanity/react-loader"; import Article from "src/components/sections/article/Article"; import ArticlePreview from "src/components/sections/article/ArticlePreview"; -import Callout from "src/components/sections/callout/Callout"; -import CalloutPreview from "src/components/sections/callout/CalloutPreview"; import CallToAction from "src/components/sections/callToAction/CallToAction"; import CallToActionPreview from "src/components/sections/callToAction/CallToActionPreview"; import CompensationCalculator from "src/components/sections/compensation-calculator/CompensationCalculator"; @@ -31,7 +29,6 @@ import { Locale } from "src/i18n/routing"; import { ArticleSection, CallToActionSection, - CalloutSection, CustomerCasesEntrySection, GridSection, HeroSection, @@ -96,19 +93,6 @@ const renderArticleSection = ( ); }; -const renderCalloutSection = ( - section: CalloutSection, - sectionIndex: number, - isDraftMode: boolean, - initialData: QueryResponseInitial, -) => { - return isDraftMode ? ( - - ) : ( - - ); -}; - const renderCallToActionSection = ( section: CallToActionSection, sectionIndex: number, @@ -235,13 +219,6 @@ const SectionRenderer = ({ isDraftMode, initialData, ); - case "callout": - return renderCalloutSection( - section, - sectionIndex, - isDraftMode, - initialData, - ); case "ctaSection": return renderCallToActionSection( section, diff --git a/studio/lib/interfaces/pages.ts b/studio/lib/interfaces/pages.ts index 8cd915ede..c65a3aaf5 100644 --- a/studio/lib/interfaces/pages.ts +++ b/studio/lib/interfaces/pages.ts @@ -31,13 +31,6 @@ export interface ArticleSection { imageExtended: ImageExtendedProps; } -export interface CalloutSection { - _type: "callout"; - _key: string; - richText?: PortableTextBlock[]; - link?: ILink; -} - export interface CallToActionSection { _type: "ctaSection"; _key: string; @@ -197,7 +190,6 @@ export type Section = | HeroSection | LogoSaladSection | ArticleSection - | CalloutSection | CallToActionSection | TestimonialsSection | ImageSection diff --git a/studio/lib/queries/pages.ts b/studio/lib/queries/pages.ts index bf32927d3..5ed161b63 100644 --- a/studio/lib/queries/pages.ts +++ b/studio/lib/queries/pages.ts @@ -26,13 +26,6 @@ const SECTIONS_FRAGMENT = groq` ${TRANSLATED_LINK_FRAGMENT} } }, - _type == "callout" => { - ..., - link { - ..., - ${TRANSLATED_LINK_FRAGMENT} - } - }, _type == "imageSplitSection" => { ..., "content": content[]{ diff --git a/studio/schemas/documents/pageBuilder.ts b/studio/schemas/documents/pageBuilder.ts index fceff3991..015405e6e 100644 --- a/studio/schemas/documents/pageBuilder.ts +++ b/studio/schemas/documents/pageBuilder.ts @@ -48,7 +48,6 @@ const pageBuilder = defineType({ hero, logoSalad, article, - // callout, // callToAction, // testimonals, imageSplitSection, diff --git a/studio/schemas/objects/sections/callout.ts b/studio/schemas/objects/sections/callout.ts deleted file mode 100644 index 13bc2ac55..000000000 --- a/studio/schemas/objects/sections/callout.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineField } from "sanity"; - -import { richText, richTextID } from "studio/schemas/fields/text"; -import { link } from "studio/schemas/objects/link"; - -const calloutID = "callout"; - -export const callout = defineField({ - name: calloutID, - title: "Callout", - type: "object", - fields: [richText, link], - initialValue: { - theme: "primary", - }, - preview: { - select: { - blocks: `${richTextID}.0.children`, - }, - prepare(value) { - const block = value.blocks - .filter((child: { _type: string }) => child._type === "span") - .map((span: { text: string }) => span.text) - .join(""); - - return { - title: block ? block : "No title", - subtitle: "Callout", - }; - }, - }, -}); - -export default callout; From e1e93902ac7a9560db07878b351778f100a59473 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 20 Dec 2024 11:30:10 +0100 Subject: [PATCH 2/5] delete testimonials --- README.md | 4 +- .../sections/testimonials/Testimonials.tsx | 91 ------ .../testimonials/TestimonialsPreview.tsx | 37 --- .../testimonials/testimonials.module.css | 266 ------------------ src/utils/renderSection.tsx | 26 -- studio/lib/interfaces/pages.ts | 16 -- .../schemas/objects/sections/testimonials.ts | 49 ---- 7 files changed, 2 insertions(+), 487 deletions(-) delete mode 100644 src/components/sections/testimonials/Testimonials.tsx delete mode 100644 src/components/sections/testimonials/TestimonialsPreview.tsx delete mode 100644 src/components/sections/testimonials/testimonials.module.css delete mode 100644 studio/schemas/objects/sections/testimonials.ts diff --git a/README.md b/README.md index c7a15a6a9..9cc5bd0d4 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ In addition to the primary Sanity Studio (accessible at http://localhost:3000/st ### Features of Shared Studio -- Customer Cases: Customer Cases is another content type available in the Shared Studio, enabling you to showcase client stories or testimonials. +- Customer Cases: Customer Cases is another content type available in the Shared Studio, enabling you to showcase client stories. Accessing Shared Studio @@ -138,7 +138,7 @@ The `Company Information` menu allows you to configure global settings for your ### Pages - **Creating Pages**: Content editors can create and manage pages under the `Pages` menu in the Sanity Studio. -- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, testimonials, features, callToAction and grid. +- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, features, callToAction and grid. ## Development diff --git a/src/components/sections/testimonials/Testimonials.tsx b/src/components/sections/testimonials/Testimonials.tsx deleted file mode 100644 index 86d188054..000000000 --- a/src/components/sections/testimonials/Testimonials.tsx +++ /dev/null @@ -1,91 +0,0 @@ -"use client"; -import { SanityImage } from "src/components/image/SanityImage"; -import { RichText } from "src/components/richText/RichText"; -import Text from "src/components/text/Text"; -import useTabs from "src/utils/hooks/useTabs"; -import { TestimonialsSection } from "studio/lib/interfaces/pages"; - -import styles from "./testimonials.module.css"; - -interface TestimonialsProps { - testimonials: TestimonialsSection; -} - -export const Testimonials = ({ testimonials }: TestimonialsProps) => { - const { tabListRef, selectedTabIndex } = useTabs(); - - if (!testimonials.listOfTestimonials) { - return null; - } - - const imageStyling = testimonials.imagesAsCircles - ? styles.avatar - : styles.image; - - return ( -
-
- - {testimonials.basicTitle} - -
-
    - {testimonials.listOfTestimonials.map((testimony, index) => { - const isSelected = selectedTabIndex === index; - return ( -
  • - -
  • - ); - })} -
-
- {testimonials.listOfTestimonials.map( - (content, index) => - content.richText && ( -
- -
- ), - )} -
-
-
-
- ); -}; diff --git a/src/components/sections/testimonials/TestimonialsPreview.tsx b/src/components/sections/testimonials/TestimonialsPreview.tsx deleted file mode 100644 index 09731a30c..000000000 --- a/src/components/sections/testimonials/TestimonialsPreview.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import { useQuery } from "@sanity/react-loader"; -import { Suspense } from "react"; - -import { PreviewProps } from "src/types/preview"; -import { PageBuilder, TestimonialsSection } from "studio/lib/interfaces/pages"; -import { PAGE_QUERY } from "studio/lib/queries/pages"; - -import { Testimonials } from "./Testimonials"; - -export default function TestimonialsPreview({ - sectionIndex, - initialData, -}: PreviewProps) { - const { data: newData } = useQuery( - PAGE_QUERY, - { id: initialData.data._id, language: initialData.data.language }, - { initial: initialData }, - ); - - const testimonialsSection = newData - ? (newData.sections.find( - (section, index) => - section._type === "testimonials" && index === sectionIndex, - ) as TestimonialsSection) - : (initialData.data.sections.find( - (section, index) => - section._type === "testimonials" && index === sectionIndex, - ) as TestimonialsSection); - - return ( - - - - ); -} diff --git a/src/components/sections/testimonials/testimonials.module.css b/src/components/sections/testimonials/testimonials.module.css deleted file mode 100644 index b84ef4128..000000000 --- a/src/components/sections/testimonials/testimonials.module.css +++ /dev/null @@ -1,266 +0,0 @@ -.article { - display: flex; - flex-direction: column; - background: var(--background-bg-light-primary); - overflow: hidden; - - /* side-padding is set to 0 for scrollable tablist */ - padding: 5rem 0; - - @media (min-width: 1024px) { - align-items: center; - padding: 10rem 7.5rem; - } -} - -.wrapper { - width: 100%; - max-width: var(--max-content-width-medium); - display: flex; - flex-direction: column; - gap: 1.5rem; -} - -/* side-padding is added to title and content */ -.sidePadding { - @media (max-width: 1024px) { - padding-inline: 2rem; - } -} - -.tabSection { - width: 100%; - display: flex; - flex-direction: column; - gap: 1rem; - align-self: stretch; - - @media (min-width: 1024px) { - flex-direction: row; - gap: 3rem; - } -} - -.tabList { - flex: 1; - display: inline-flex; - list-style: none; - gap: 1rem; - - margin: 0; - padding: 0; - - @media (max-width: 1024px) { - padding-left: 2rem; - padding-top: 4px; - padding-bottom: 8px; - overflow-x: auto; - scrollbar-width: none; /* Firefox */ - /* Hide scrollbar for Chrome, Safari and Opera */ - &::-webkit-scrollbar { - display: none; - } - } - - @media (min-width: 1024px) { - flex-direction: column; - max-width: 420px; - width: 100%; - } - - & > li { - @media (min-width: 1024px) { - width: 100%; - } - } -} - -.tab { - all: unset; - z-index: 1; - position: relative; - display: flex; - padding: 0.5rem; - background-color: var(--background-bg-light-primary); - color: var(--text-primary); - font-family: var(--font-britti-sans); - align-items: center; - gap: 0.5rem; - border-radius: 0.9375rem; - outline: none; - border: none; - white-space: nowrap; - cursor: pointer; - transition: - color 100ms, - background-color 100ms; - @media (min-width: 1024px) { - width: 100%; - } - - &:hover { - background-color: var(--background-bg-light-secondary); - - &:after { - background-color: var(--background-bg-light-secondary); - } - } - - &:active { - background-color: var(--background-bg-light-primary); - - &:after { - background-color: var(--background-bg-light-primary); - } - } - - &:focus-visible { - outline: 2px solid var(--stroke-primary); - border-radius: 0.9375rem; - } - - &:after { - z-index: -1; - content: ""; - width: 0.975rem; - height: 0.975rem; - transform: rotate(45deg); - background-color: var(--background-bg-light-primary); - border-radius: 0.125rem; - position: absolute; - transition: - left 100ms, - right 100ms, - bottom 100ms, - background-color 100ms, - color 100ms; - } - - @media (max-width: 1024px) { - &:after { - left: 5.37306rem; - bottom: 0.1rem; - } - } - - @media (min-width: 1024px) { - &:after { - right: 0.06238rem; - bottom: 40%; - } - } -} - -.selected { - color: var(--background-bg-light-primary); - transition: - color 100ms, - background-color 100ms; - - &:after { - left: 50%; - transition: - left 100ms, - right 100ms, - bottom 100ms, - background-color 100ms, - color 100ms; - } - - @media (max-width: 1024px) { - &:after { - bottom: -0.31638rem; - } - } - - @media (min-width: 1024px) { - &:after { - bottom: 40%; - } - } - - &:focus-visible { - outline: 2px solid #3995ef; - border-radius: 0.9375rem; - } -} - -.info { - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 0.125rem; - min-width: 140px; -} - -.image { - width: 7rem; - height: 3rem; - flex-shrink: 0; - - border-radius: 0.625rem; - overflow: hidden; -} - -.avatar { - width: 1.875rem; - height: 1.875rem; - border-radius: 3.125rem; - overflow: hidden; - - @media (min-width: 1024px) { - width: 4rem; - height: 4rem; - flex-shrink: 0; - } -} - -.title { - font-size: 1.375rem; - font-weight: 500; - line-height: 100%; - - @media (min-width: 1024px) { - font-size: 1.625rem; - } -} - -.subTitle { - font-size: 0.875rem; - font-weight: 500; - line-height: normal; - - @media (min-width: 1024px) { - font-size: 1rem; - } -} - -.contentWrapper { - flex: 2; - position: relative; - min-height: 220px; -} - -.content { - composes: sidePadding; - display: flex; - flex-direction: column; - gap: 1rem; - outline: none; - opacity: 0; - - position: absolute; - visibility: hidden; - transition: opacity 100ms ease-in-out height 100ms ease-in-out; - - @media (min-width: 1024px) { - padding-inline: 0; - } -} - -.content.visible { - opacity: 1; - visibility: visible; - position: relative; - transition: opacity 100ms ease-in-out height 100ms ease-in-out; -} diff --git a/src/utils/renderSection.tsx b/src/utils/renderSection.tsx index 97255eb9d..3968e32f5 100644 --- a/src/utils/renderSection.tsx +++ b/src/utils/renderSection.tsx @@ -23,8 +23,6 @@ import Learning from "src/components/sections/learning/Learning"; import { LogoSalad } from "src/components/sections/logoSalad/LogoSalad"; import LogoSaladPreview from "src/components/sections/logoSalad/LogoSaladPreview"; import Openness from "src/components/sections/openness/Openness"; -import { Testimonials } from "src/components/sections/testimonials/Testimonials"; -import TestimonialsPreview from "src/components/sections/testimonials/TestimonialsPreview"; import { Locale } from "src/i18n/routing"; import { ArticleSection, @@ -37,7 +35,6 @@ import { LogoSaladSection, PageBuilder, Section, - TestimonialsSection, } from "studio/lib/interfaces/pages"; interface SectionRendererProps { @@ -109,22 +106,6 @@ const renderCallToActionSection = ( ); }; -const renderTestimonialsSection = ( - section: TestimonialsSection, - sectionIndex: number, - isDraftMode: boolean, - initialData: QueryResponseInitial, -) => { - return isDraftMode ? ( - - ) : ( - - ); -}; - const renderImageSection = ( section: ImageSection, sectionIndex: number, @@ -226,13 +207,6 @@ const SectionRenderer = ({ isDraftMode, initialData, ); - case "testimonials": - return renderTestimonialsSection( - section, - sectionIndex, - isDraftMode, - initialData, - ); case "imageSection": return renderImageSection( section, diff --git a/studio/lib/interfaces/pages.ts b/studio/lib/interfaces/pages.ts index c65a3aaf5..1d7e434e7 100644 --- a/studio/lib/interfaces/pages.ts +++ b/studio/lib/interfaces/pages.ts @@ -38,21 +38,6 @@ export interface CallToActionSection { callToActions?: ILink[]; } -export interface TestimonialsSection { - _type: "testimonials"; - _key: string; - basicTitle?: string; - imagesAsCircles: boolean; - listOfTestimonials: { - _type: string; - _key: string; - image: IImage; - basicTitle: string; - subTitle: string; - richText: PortableTextBlock[]; - }[]; -} - export interface ImageSection { _type: "imageSection"; _key: string; @@ -191,7 +176,6 @@ export type Section = | LogoSaladSection | ArticleSection | CallToActionSection - | TestimonialsSection | ImageSection | ImageSplitSection | GridSection diff --git a/studio/schemas/objects/sections/testimonials.ts b/studio/schemas/objects/sections/testimonials.ts deleted file mode 100644 index 58bad8b26..000000000 --- a/studio/schemas/objects/sections/testimonials.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { defineField } from "sanity"; - -import { title } from "studio/schemas/fields/text"; -import testimony from "studio/schemas/objects/testimony"; - -const testimonialsID = "testimonials"; - -export const testimonals = defineField({ - name: testimonialsID, - title: "Testimonials", - type: "object", - fields: [ - title, - { - name: "listOfTestimonials", - title: "List of Testimonials", - type: "array", - of: [testimony], - validation: (rule) => - rule - .required() - .min(1) - .max(4) - .error("You must have between 1 and 4 testimonials."), - }, - { - name: "imagesAsCircles", - title: "Display Images as Circles", - type: "boolean", - description: - "Enable this option to crop testimonial images into circular shapes.", - initialValue: false, - }, - ], - preview: { - select: { - title: "basicTitle", - }, - prepare(selection) { - const { title } = selection; - return { - title: title, - subtitle: "Testimonials", - }; - }, - }, -}); - -export default testimonals; From b1b0b77b2f507e80099d49a2d8dcdc7b97200ab9 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 20 Dec 2024 12:40:31 +0100 Subject: [PATCH 3/5] remove calltoactionsection --- README.md | 2 +- .../sections/callToAction/CallToAction.tsx | 29 ----------- .../callToAction/CallToActionPreview.tsx | 37 -------------- .../callToAction/callToAction.module.css | 41 ---------------- src/utils/renderSection.tsx | 26 ---------- studio/lib/interfaces/pages.ts | 8 ---- studio/lib/queries/pages.ts | 7 --- studio/schemas/documents/pageBuilder.ts | 2 - .../schemas/objects/sections/callToAction.ts | 48 ------------------- 9 files changed, 1 insertion(+), 199 deletions(-) delete mode 100644 src/components/sections/callToAction/CallToAction.tsx delete mode 100644 src/components/sections/callToAction/CallToActionPreview.tsx delete mode 100644 src/components/sections/callToAction/callToAction.module.css delete mode 100644 studio/schemas/objects/sections/callToAction.ts diff --git a/README.md b/README.md index 9cc5bd0d4..515959ce1 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ The `Company Information` menu allows you to configure global settings for your ### Pages - **Creating Pages**: Content editors can create and manage pages under the `Pages` menu in the Sanity Studio. -- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, features, callToAction and grid. +- **Adding Sections**: Each page can be customized with structured content that includes various predefined sections such as hero, article, features and grid. ## Development diff --git a/src/components/sections/callToAction/CallToAction.tsx b/src/components/sections/callToAction/CallToAction.tsx deleted file mode 100644 index d68e5de9d..000000000 --- a/src/components/sections/callToAction/CallToAction.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import LinkButton from "src/components/linkButton/LinkButton"; -import Text from "src/components/text/Text"; -import { CallToActionSection } from "studio/lib/interfaces/pages"; - -import styles from "./callToAction.module.css"; - -interface CallToActionProps { - callToAction: CallToActionSection; -} - -const CallToAction = ({ callToAction }: CallToActionProps) => { - return ( -
- {callToAction?.basicTitle} -
    - {callToAction?.callToActions?.map((cta, index) => ( -
  • - -
  • - ))} -
-
- ); -}; - -export default CallToAction; diff --git a/src/components/sections/callToAction/CallToActionPreview.tsx b/src/components/sections/callToAction/CallToActionPreview.tsx deleted file mode 100644 index 288db6f9e..000000000 --- a/src/components/sections/callToAction/CallToActionPreview.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import { useQuery } from "@sanity/react-loader"; -import { Suspense } from "react"; - -import { PreviewProps } from "src/types/preview"; -import { CallToActionSection, PageBuilder } from "studio/lib/interfaces/pages"; -import { PAGE_QUERY } from "studio/lib/queries/pages"; - -import CallToAction from "./CallToAction"; - -export default function CallToActionPreview({ - initialData, - sectionIndex, -}: PreviewProps) { - const { data: newData } = useQuery( - PAGE_QUERY, - { id: initialData.data._id, language: initialData.data.language }, - { initial: initialData }, - ); - - const callToActionSection = newData - ? (newData.sections.find( - (section, index) => - section._type === "ctaSection" && index === sectionIndex, - ) as CallToActionSection) - : (initialData.data.sections.find( - (section, index) => - section._type === "ctaSection" && index === sectionIndex, - ) as CallToActionSection); - - return ( - - - - ); -} diff --git a/src/components/sections/callToAction/callToAction.module.css b/src/components/sections/callToAction/callToAction.module.css deleted file mode 100644 index 5e17d3204..000000000 --- a/src/components/sections/callToAction/callToAction.module.css +++ /dev/null @@ -1,41 +0,0 @@ -.article { - display: flex; - flex-direction: column; - align-items: center; - text-align: center; - gap: 1.5rem; - padding: 5rem 2rem; - background: var(--surface-green); - - @media (min-width: 640px) { - padding: 5rem 3rem; - } - - @media (min-width: 1024px) { - padding: 15rem 7.5rem; - } -} - -.list { - list-style-type: none; - margin: 0; - padding: 0; - display: flex; - flex-direction: column; - align-items: center; - gap: 1.5rem; - align-self: stretch; - - @media (min-width: 1024px) { - display: flex; - flex-direction: row; - justify-content: center; - align-items: flex-start; - } - - @media (max-width: 1024px) { - & > li { - width: 100%; - } - } -} diff --git a/src/utils/renderSection.tsx b/src/utils/renderSection.tsx index 3968e32f5..d7baa8eed 100644 --- a/src/utils/renderSection.tsx +++ b/src/utils/renderSection.tsx @@ -2,8 +2,6 @@ import { QueryResponseInitial } from "@sanity/react-loader"; import Article from "src/components/sections/article/Article"; import ArticlePreview from "src/components/sections/article/ArticlePreview"; -import CallToAction from "src/components/sections/callToAction/CallToAction"; -import CallToActionPreview from "src/components/sections/callToAction/CallToActionPreview"; import CompensationCalculator from "src/components/sections/compensation-calculator/CompensationCalculator"; import ContactBox from "src/components/sections/contact-box/ContactBox"; import CustomerCasesEntry from "src/components/sections/customerCasesEntry/CustomerCasesEntry"; @@ -26,7 +24,6 @@ import Openness from "src/components/sections/openness/Openness"; import { Locale } from "src/i18n/routing"; import { ArticleSection, - CallToActionSection, CustomerCasesEntrySection, GridSection, HeroSection, @@ -90,22 +87,6 @@ const renderArticleSection = ( ); }; -const renderCallToActionSection = ( - section: CallToActionSection, - sectionIndex: number, - isDraftMode: boolean, - initialData: QueryResponseInitial, -) => { - return isDraftMode ? ( - - ) : ( - - ); -}; - const renderImageSection = ( section: ImageSection, sectionIndex: number, @@ -200,13 +181,6 @@ const SectionRenderer = ({ isDraftMode, initialData, ); - case "ctaSection": - return renderCallToActionSection( - section, - sectionIndex, - isDraftMode, - initialData, - ); case "imageSection": return renderImageSection( section, diff --git a/studio/lib/interfaces/pages.ts b/studio/lib/interfaces/pages.ts index 1d7e434e7..1e02a729a 100644 --- a/studio/lib/interfaces/pages.ts +++ b/studio/lib/interfaces/pages.ts @@ -31,13 +31,6 @@ export interface ArticleSection { imageExtended: ImageExtendedProps; } -export interface CallToActionSection { - _type: "ctaSection"; - _key: string; - basicTitle?: string; - callToActions?: ILink[]; -} - export interface ImageSection { _type: "imageSection"; _key: string; @@ -175,7 +168,6 @@ export type Section = | HeroSection | LogoSaladSection | ArticleSection - | CallToActionSection | ImageSection | ImageSplitSection | GridSection diff --git a/studio/lib/queries/pages.ts b/studio/lib/queries/pages.ts index 5ed161b63..5303d2695 100644 --- a/studio/lib/queries/pages.ts +++ b/studio/lib/queries/pages.ts @@ -43,13 +43,6 @@ const SECTIONS_FRAGMENT = groq` ..., "image": image {${INTERNATIONALIZED_IMAGE_FRAGMENT}}, }, - _type == "ctaSection" => { - ..., - callToActions[] { - ..., - ${TRANSLATED_LINK_FRAGMENT} - } - }, _type == "compensationCalculator" => { ..., "moduleTitle": ${translatedFieldFragment("moduleTitle")}, diff --git a/studio/schemas/documents/pageBuilder.ts b/studio/schemas/documents/pageBuilder.ts index 015405e6e..de980fe53 100644 --- a/studio/schemas/documents/pageBuilder.ts +++ b/studio/schemas/documents/pageBuilder.ts @@ -48,8 +48,6 @@ const pageBuilder = defineType({ hero, logoSalad, article, - // callToAction, - // testimonals, imageSplitSection, imageSection, // grid, diff --git a/studio/schemas/objects/sections/callToAction.ts b/studio/schemas/objects/sections/callToAction.ts deleted file mode 100644 index bab19c37a..000000000 --- a/studio/schemas/objects/sections/callToAction.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { defineField } from "sanity"; - -import callToActionField from "studio/schemas/fields/callToActionFields"; -import { title } from "studio/schemas/fields/text"; - -const callToActionSectionID = "ctaSection"; - -export const callToAction = defineField({ - name: callToActionSectionID, - title: "Call to Action", - type: "object", - fields: [ - { - ...title, - description: - "This will be the title of the call to action section. Make it engaging to capture the attention of your audience.", - }, - { - name: "callToActions", - title: "Call to Actions", - description: - "The first Call to Action (CTA) will be styled as a primary link button.", - type: "array", - of: [ - { - type: "object", - fields: callToActionField.fields, - preview: callToActionField.preview, - }, - ], - validation: (rule) => rule.required(), - }, - ], - preview: { - select: { - title: "basicTitle", - }, - prepare(selection) { - const { title } = selection; - return { - title: title || "No title", - subtitle: "Call to Action", - }; - }, - }, -}); - -export default callToAction; From 2798ec02a5e657442a78dae1c2bbe0c36637afb8 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 20 Dec 2024 14:14:55 +0100 Subject: [PATCH 4/5] deleted tesimony --- studio/schemas/objects/testimony.ts | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 studio/schemas/objects/testimony.ts diff --git a/studio/schemas/objects/testimony.ts b/studio/schemas/objects/testimony.ts deleted file mode 100644 index b4e58f9f9..000000000 --- a/studio/schemas/objects/testimony.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { StringInputProps, StringRule } from "sanity"; - -import { StringInputWithCharacterCount } from "studio/components/stringInputWithCharacterCount/StringInputWithCharacterCount"; -import image from "studio/schemas/fields/media"; -import { richText, title } from "studio/schemas/fields/text"; - -export const testimony = { - name: "testimony", - type: "object", - title: "Testimony", - fields: [ - title, - { - name: "subTitle", - type: "string", - title: "Subtitle", - validation: (rule: StringRule) => rule.max(100), - components: { - input: (props: StringInputProps) => - StringInputWithCharacterCount({ ...props, maxCount: 100 }), - }, - }, - image, - richText, - ], -}; - -export default testimony; From e67674960a972093224d93b947facff99a57f3a3 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 20 Dec 2024 14:18:55 +0100 Subject: [PATCH 5/5] delete customcalltoaction --- studio/components/CustomCallToActions.tsx | 81 ----------------------- studio/lib/queries/siteSettings.ts | 4 -- 2 files changed, 85 deletions(-) delete mode 100644 studio/components/CustomCallToActions.tsx diff --git a/studio/components/CustomCallToActions.tsx b/studio/components/CustomCallToActions.tsx deleted file mode 100644 index 7f9f4eff4..000000000 --- a/studio/components/CustomCallToActions.tsx +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; - -import { Card, Text } from "@sanity/ui"; -import React, { useEffect, useState } from "react"; -import { - ArrayOfObjectsInput, - ArrayOfObjectsInputProps, - ArraySchemaType, - LoadingBlock, - useFormValue, -} from "sanity"; - -import { fetchWithToken } from "studio/lib/fetchWithToken"; -import { LANDING_PAGE_REF_QUERY } from "studio/lib/queries/siteSettings"; -import { buildPublishedId } from "studio/utils/documentUtils"; - -type CustomCallToActionsProps = ArrayOfObjectsInputProps< - { _key: string }, - ArraySchemaType ->; - -const CustomCallToActions: React.FC = (props) => { - const [isLandingPage, setIsLandingPage] = useState(false); - const [landingPageId, setLandingPageId] = useState(null); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - const documentId = useFormValue(["_id"]) as string; - - useEffect(() => { - const fetchLandingId = async () => { - try { - setLoading(true); - const landingId = await fetchWithToken(LANDING_PAGE_REF_QUERY); - setLandingPageId(landingId); - } catch (error) { - console.error("Failed to fetch navigation manager", error); - setError((error as Error).message); - } finally { - setLoading(false); - } - }; - - fetchLandingId(); - }, []); - - useEffect(() => { - if (!landingPageId) return; - - const currentPageId = buildPublishedId(documentId); - - const isLanding = landingPageId === currentPageId; - - setIsLandingPage(isLanding); - }, [documentId, landingPageId]); - - if (loading) { - return ; - } - - if (error) { - return ( - - Error: {error} - - ); - } - - if (!isLandingPage) { - return ( - - - This feature is only available for landing pages - - - ); - } - return ; -}; - -export default CustomCallToActions; diff --git a/studio/lib/queries/siteSettings.ts b/studio/lib/queries/siteSettings.ts index d4e2e1095..6557111ca 100644 --- a/studio/lib/queries/siteSettings.ts +++ b/studio/lib/queries/siteSettings.ts @@ -38,10 +38,6 @@ export const NAV_QUERY = groq` } `; -export const LANDING_PAGE_REF_QUERY = groq` - *[_type == "navigationManager"][0].setLanding._ref -`; - export const LANDING_PAGE_QUERY = groq` *[_type == "navigationManager"][0].setLanding -> { ${PAGE_FRAGMENT}