From fc6403789dc642a0c3924c03ce8724a7eddec22b Mon Sep 17 00:00:00 2001 From: "Aman Kumar [SSW]" <71385247+amankumarrr@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:52:43 +1100 Subject: [PATCH] fixing the call to action import --- app/consulting/[filename]/consulting.tsx | 56 ++++++++++++++++++++++-- components/callToAction/callToAction.tsx | 6 ++- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/app/consulting/[filename]/consulting.tsx b/app/consulting/[filename]/consulting.tsx index 4ca8fe70e0..4c3ad62c4e 100644 --- a/app/consulting/[filename]/consulting.tsx +++ b/app/consulting/[filename]/consulting.tsx @@ -6,21 +6,24 @@ import { BuiltOnAzure } from "@/components/blocks/builtOnAzure"; import { ClientLogos } from "@/components/blocks/clientLogos"; import { componentRenderer } from "@/components/blocks/mdxComponentRenderer"; import { BookingButton } from "@/components/bookingButton/bookingButton"; +import { CallToAction } from "@/components/callToAction/callToAction"; import MediaCards from "@/components/consulting/mediaCard/mediaCards"; import { Marketing } from "@/components/marketing/Marketing"; import TechnologyCards from "@/components/technologyCard/technologyCards"; import { TestimonialRow } from "@/components/testimonials/TestimonialRow"; import { Benefits } from "@/components/util/consulting/benefits"; import { Container } from "@/components/util/container"; - import { Section } from "@/components/util/section"; +import { sanitiseXSS, spanWhitelist } from "@/helpers/validator"; import { removeExtension } from "@/services/client/utils.service"; import { Breadcrumbs } from "app/components/breadcrumb"; +import { ReactElement } from "react"; +import ReactDOMServer from "react-dom/server"; import { tinaField } from "tinacms/dist/react"; import { TinaMarkdown } from "tinacms/dist/rich-text"; -export default function Consulting({ props, tinaProps }) { - const { categories, marketingData, mediaCardProps, techCards } = props; +export default function Consulting({ tinaProps, props }) { + const { techCards, marketingData, categories, mediaCardProps } = props; const { data } = tinaProps; return ( <> @@ -103,9 +106,56 @@ export default function Consulting({ props, tinaProps }) { )} + {data?.consulting?.callToAction?.showCallToAction && ( + +

+
+ )}
); } + +const parseCallToAction = ( + content: string, + project: string, + data: { project?: string } +) => { + const HTMLelement: ReactElement = ( + + {project} + + ); + + return sanitiseXSS( + content?.replace("{{TITLE}}", ReactDOMServer.renderToString(HTMLelement)), + spanWhitelist + ); +}; diff --git a/components/callToAction/callToAction.tsx b/components/callToAction/callToAction.tsx index 613cb7c454..9e2f1721c1 100644 --- a/components/callToAction/callToAction.tsx +++ b/components/callToAction/callToAction.tsx @@ -1,5 +1,7 @@ -import { BookingButton } from "../blocks"; -import { bookingButtonSchema } from "../bookingButton/bookingButton"; +import { + BookingButton, + bookingButtonSchema, +} from "../bookingButton/bookingButton"; import { Container } from "../util/container"; import { Section } from "../util/section";