-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e51e92
commit 680a176
Showing
7 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
}, | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IProps> = (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 (<Grid container item sx={{ | ||
backgroundColor: theme.palette.secondary.main, | ||
backgroundImage: `url(${urlFor(props.sectionData.backgroundImgSrc).url()})`, | ||
backgroundSize: "40%, 40%", | ||
// backgroundRepeat: "no-repeat", | ||
borderRadius: mdDown?0:1, | ||
border:mdDown?'none':`1px solid ${theme.palette.primary.main}`, | ||
marginLeft: mdDown?0:props.sectionData.insetLeft, | ||
marginRight: mdDown?0:props.sectionData.insetRight, | ||
marginTop: mdDown?0:props.sectionData.insetTop, | ||
marginBottom: mdDown?0:props.sectionData.insetBottom, | ||
}}> | ||
<Grid container alignItems='center' alignContent='center' item | ||
style={{ padding: "40px"}} md={8}> | ||
<Typography variant={'h4'} color='primary'> | ||
{props.sectionData.contentText} | ||
</Typography> | ||
</Grid> | ||
<Grid style={{padding: "40px"}} container item justifyContent={smDown?'center':'flex-end'} alignItems='center' alignContent='center' md={4} > | ||
<Button color='primary' variant='contained' | ||
onClick={() => { | ||
firebaseAnalyticsClient.ctaClick("hero-section", props.sectionData.ctaButtonText, pageContext.analyticsId,) | ||
}} | ||
href={props.sectionData.ctaButtonLink ?? ""}> | ||
<Typography variant='button' | ||
color='secondary'>{props.sectionData.ctaButtonText}</Typography> | ||
</Button> | ||
</Grid> | ||
</Grid>) | ||
} | ||
|
||
export default HeadlineCTASection |