1- import { Suspense } from " react" ;
2- import { PortableTextBlock } from " next-sanity" ;
1+ import { Suspense } from ' react'
2+ import { PortableTextBlock } from ' next-sanity'
33
4- import ResolvedLink from " @/app/components/ResolvedLink" ;
5- import PortableText from " @/app/components/PortableText" ;
6- import Image from " @/app/components/SanityImage" ;
7- import { stegaClean } from " @sanity/client/stega" ;
8- import { ExtractPageBuilderType } from " @/sanity/lib/types" ;
4+ import ResolvedLink from ' @/app/components/ResolvedLink'
5+ import PortableText from ' @/app/components/PortableText'
6+ import Image from ' @/app/components/SanityImage'
7+ import { stegaClean } from ' @sanity/client/stega'
8+ import { ExtractPageBuilderType } from ' @/sanity/lib/types'
99
1010type CtaProps = {
11- block : ExtractPageBuilderType < " callToAction" > ;
12- index : number ;
11+ block : ExtractPageBuilderType < ' callToAction' >
12+ index : number
1313 // Needed if you want to createDataAttributes to do non-text overlays in Presentation (Visual Editing)
14- pageType : string ;
15- pageId : string ;
16- } ;
14+ pageType : string
15+ pageId : string
16+ }
1717
18- export default function CTA ( { block } : CtaProps ) {
19- const {
20- heading,
21- eyebrow,
22- body = [ ] ,
23- button,
24- image,
25- theme,
26- contentAlignment,
27- } = block ;
18+ export default function CTA ( { block} : CtaProps ) {
19+ const { heading, eyebrow, body = [ ] , button, image, theme, contentAlignment} = block
2820
29- const isDark = theme === " dark" ;
30- const isImageFirst = stegaClean ( contentAlignment ) === " imageFirst" ;
21+ const isDark = theme === ' dark'
22+ const isImageFirst = stegaClean ( contentAlignment ) === ' imageFirst'
3123
3224 return (
33- < section
34- className = {
35- isDark ? "relative dark dark:bg-black" : "relative dark:bg-black"
36- }
37- >
25+ < section className = { isDark ? 'relative dark dark:bg-black' : 'relative dark:bg-black' } >
3826 < div className = "absolute inset-0 bg-size-[5px] bg-[url(/images/tile-1-black.png)] dark:bg-[url(/images/tile-1-white.png)] opacity-25" />
3927 < div className = "container relative" >
4028 < div className = "grid lg:grid-cols-2 gap-12 py-12" >
4129 < div
42- className = { `${ isImageFirst && image ? " row-start-2 lg:row-start-1 lg:col-start-2" : "" } flex flex-col gap-2 ` }
30+ className = { `${ isImageFirst && image ? ' row-start-2 lg:row-start-1 lg:col-start-2' : '' } flex flex-col gap-2 ` }
4331 >
4432 { eyebrow && (
4533 < span className = "text-sm uppercase dark:text-white font-mono tracking-tight opacity-70" >
4634 { eyebrow }
4735 </ span >
4836 ) }
4937 { heading && (
50- < h2 className = "text-2xl md:text-3xl lg:text-4xl dark:text-white" >
51- { heading }
52- </ h2 >
38+ < h2 className = "text-2xl md:text-3xl lg:text-4xl dark:text-white" > { heading } </ h2 >
5339 ) }
5440 { body && (
5541 < div className = "lg:text-left" >
56- < PortableText
57- value = { body as PortableTextBlock [ ] }
58- className = "dark:prose-invert"
59- />
42+ < PortableText value = { body as PortableTextBlock [ ] } className = "dark:prose-invert" />
6043 </ div >
6144 ) }
6245
63- < Suspense fallback = { null } >
64- { button ?. buttonText && button ?. link && (
65- < div className = "flex mt-4" >
66- < ResolvedLink
67- link = { button ?. link }
68- className = "rounded-full flex gap-2 font-mono text-sm whitespace-nowrap items-center bg-black dark:bg-white hover:bg-blue focus:bg-blue py-3 px-6 text-white dark:text-black dark:hover:text-white transition-colors duration-200"
69- >
70- { button ?. buttonText }
71- </ ResolvedLink >
72- </ div >
73- ) }
74- </ Suspense >
46+ { button ?. buttonText && button ?. link && (
47+ < div className = "flex mt-4" >
48+ < ResolvedLink
49+ link = { button ?. link }
50+ className = "rounded-full flex gap-2 font-mono text-sm whitespace-nowrap items-center bg-black dark:bg-white hover:bg-blue focus:bg-blue py-3 px-6 text-white dark:text-black dark:hover:text-white transition-colors duration-200"
51+ >
52+ { button ?. buttonText }
53+ </ ResolvedLink >
54+ </ div >
55+ ) }
7556 </ div >
7657
7758 { image ?. asset ?. _ref && (
@@ -87,5 +68,5 @@ export default function CTA({ block }: CtaProps) {
8768 </ div >
8869 </ div >
8970 </ section >
90- ) ;
71+ )
9172}
0 commit comments