From 680a17660935bf8fbe529284fbbad2b96c14a0c3 Mon Sep 17 00:00:00 2001 From: "Mr. Singleton" Date: Wed, 29 Nov 2023 02:02:35 -0500 Subject: [PATCH] adds headline section with CTA (#9) --- sanityIo/schemas/HeadlineCTASection.js | 61 +++++++++++++++++++ sanityIo/schemas/contentContainer.js | 1 + sanityIo/schemas/schema.js | 4 +- .../BlockContentLayoutContainer.tsx | 11 +++- src/components/BlockContentTypes.ts | 12 ++++ .../animated/AnimatedPortfolioSection.tsx | 2 +- .../animated/HeadlineCTASection.tsx | 58 ++++++++++++++++++ 7 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 sanityIo/schemas/HeadlineCTASection.js create mode 100644 src/components/animated/HeadlineCTASection.tsx diff --git a/sanityIo/schemas/HeadlineCTASection.js b/sanityIo/schemas/HeadlineCTASection.js new file mode 100644 index 00000000..a1d4b5fb --- /dev/null +++ b/sanityIo/schemas/HeadlineCTASection.js @@ -0,0 +1,61 @@ + +export default { + name: 'HeadlineCTASection', + title: "Headline CTA", + type: 'document', + fields: [ + { + name: 'name', + title: 'Name', + type: 'string', + }, + { + name: 'contentText', + title: 'Content Text', + type: 'text', + }, + { + name: 'backgroundImgSrc', + title: 'Background Image', + type: 'image', + }, + { + name: 'ctaButtonText', + title: 'CTA Button Text', + type: 'string' + }, + { + name: 'ctaButtonLink', + title: 'CTA Button Link', + type: 'string' + }, + { + name: 'insetTop', + title: 'Top Inset', + type: 'string' + }, + { + name: 'insetBottom', + title: 'Bottom Inset', + type: 'string' + }, + { + name: 'insetLeft', + title: 'Left Inset', + type: 'string' + }, + { + name: 'insetRight', + title: 'Right Inset', + type: 'string' + } + ], + preview: { + select: { + title: 'name', + }, + }, +} + + + diff --git a/sanityIo/schemas/contentContainer.js b/sanityIo/schemas/contentContainer.js index 27802f49..ef4abe41 100644 --- a/sanityIo/schemas/contentContainer.js +++ b/sanityIo/schemas/contentContainer.js @@ -24,6 +24,7 @@ export default { {name: 'column2BlockContent', title: 'Custom 2 Column Section',type: 'reference', to: [{type: 'column2BlockContent'}]}, {name: 'header', title: 'Header Menu',type: 'reference', to: [{type: 'menuContainer',}]}, {name: 'footer', title: 'Footer Menu',type: 'reference', to: [{type: 'menuContainer',}]}, + {name: 'Headline with CTA', title: 'Headline with CTA',type: 'reference', to: [{type: 'HeadlineCTASection',}]}, {name: 'HeroAnimatedContentSection', title: 'Animated Hero Content',type: 'reference', to: [{type: 'HeroAnimatedContentSection'}]}, {name: 'AnimatedAboutUsSection', title: 'Animated About Us Section',type: 'reference', to: [{type: 'AnimatedAboutUsSection'}]}, {name: 'AnimatedServicesSection', title: 'Animated Services Section',type: 'reference', to: [{type: 'AnimatedServicesSection'}]}, diff --git a/sanityIo/schemas/schema.js b/sanityIo/schemas/schema.js index 254a1334..f0417b92 100644 --- a/sanityIo/schemas/schema.js +++ b/sanityIo/schemas/schema.js @@ -90,6 +90,7 @@ import MuiFontFace from "./mui/MuiFontFace"; import MuiMediaQuery from "./mui/MuiMediaQuery"; import AnimatedPortfolioItem from "./sections/animated/AnimatedPortfolioItem"; import AnimatedPortfolioSection from "./sections/animated/AnimatedPortfolioSection"; +import HeadlineCTASection from "./HeadlineCTASection"; // Then we give our schema to the builder and provide the result to Sanity export default [ @@ -185,5 +186,6 @@ export default [ AnimatedServicesSection, AnimatedPortfolioItem, AnimatedPortfolioSection, - HeroSlideContent + HeroSlideContent, + HeadlineCTASection ] diff --git a/src/components/BlockContentLayoutContainer.tsx b/src/components/BlockContentLayoutContainer.tsx index aae236b6..1d023885 100644 --- a/src/components/BlockContentLayoutContainer.tsx +++ b/src/components/BlockContentLayoutContainer.tsx @@ -4,7 +4,7 @@ import {Card, Grid, Link, useTheme} from '@mui/material' import sanityClient from '../sanityClient' import {blockSerializers} from '../common/sanityIo/BlockContentRenderer' import { - AnimatedAboutUsSectionType, AnimatedPortfolioSectionType, AnimatedServicesSectionType, + AnimatedAboutUsSectionType, AnimatedPortfolioSectionType, AnimatedServicesSectionType, HeadlineCTASectionType, HeroAnimatedContentSectionType, HowItWorksSectionType, PortfolioSectionType, @@ -56,6 +56,7 @@ import HeroAnimatedContentSection from "./animated/HeroAnimatedContentSection"; import AnimatedAboutUsSection from "./animated/AnimatedAboutUsSection"; import AnimatedServicesSection from './animated/AnimatedServicesSection' import AnimatedPortfolioSection from "./animated/AnimatedPortfolioSection"; +import HeadlineCTASection from "./animated/HeadlineCTASection"; export type BlockContentLayoutContainerProps = { content?: any, @@ -449,6 +450,14 @@ const BlockContentLayoutContainer: FunctionComponent ); + case 'HeadlineCTASection': + const headlineSection: HeadlineCTASectionType = columnLayoutContainer + + return + + default: return // return Undefined section {columnLayoutContainer._type} diff --git a/src/components/BlockContentTypes.ts b/src/components/BlockContentTypes.ts index cf2cc3e7..5a69008b 100644 --- a/src/components/BlockContentTypes.ts +++ b/src/components/BlockContentTypes.ts @@ -623,4 +623,16 @@ export type SanityDocumentFields = { _updatedAt?: string _type?: string _id?: string +} + +export type HeadlineCTASectionType = { + name: string + contentText: string + ctaButtonText: string + ctaButtonLink: string + insetTop: string + insetBottom: string + insetLeft: string + insetRight: string + backgroundImgSrc: SanityImageAsset } \ No newline at end of file diff --git a/src/components/animated/AnimatedPortfolioSection.tsx b/src/components/animated/AnimatedPortfolioSection.tsx index 87ab07b4..0a7a21a6 100644 --- a/src/components/animated/AnimatedPortfolioSection.tsx +++ b/src/components/animated/AnimatedPortfolioSection.tsx @@ -37,7 +37,7 @@ const AnimatedPortfolioSection: FunctionComponent = (props: IProps) => { } return ( - diff --git a/src/components/animated/HeadlineCTASection.tsx b/src/components/animated/HeadlineCTASection.tsx new file mode 100644 index 00000000..f25d3045 --- /dev/null +++ b/src/components/animated/HeadlineCTASection.tsx @@ -0,0 +1,58 @@ +import React, {FunctionComponent, useContext} from 'react' +import {Button, Grid, Typography, useMediaQuery, useTheme} from "@mui/material"; +import firebaseAnalyticsClient from "../../common/firebase/FirebaseAnalyticsClient"; +import makeStyles from "@mui/styles/makeStyles"; +import {Theme} from "@mui/material/styles"; +import {HeadlineCTASectionType} from "../BlockContentTypes"; +import PageContext from "../page-context/PageContext"; +import {urlFor} from "../block-content-ui/static-pages/cmsStaticPagesClient"; + +export const useStyles = makeStyles((theme: Theme) => ({ + root: { + }, +})) + +interface IProps { sectionData: HeadlineCTASectionType } + +const HeadlineCTASection: FunctionComponent = (props:IProps) => { + const theme = useTheme() + const pageContext = useContext(PageContext) + + const smDown = useMediaQuery(theme.breakpoints.down('sm')) + const mdDown = useMediaQuery(theme.breakpoints.down('md')) + + React.useEffect(()=>{ + }, []) + + return ( + + + {props.sectionData.contentText} + + + + + + ) +} + +export default HeadlineCTASection \ No newline at end of file