Skip to content

Commit 8a26b2a

Browse files
authored
Merge pull request #22 from adityaguru149/hero-cta-null-check
check CTA defined in Hero components
2 parents 3e40bcd + 8ddd87e commit 8a26b2a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/widgets/Hero.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Image from 'next/image';
2-
import { CallToAction, HeroProps } from '~/shared/types';
2+
import { HeroProps } from '~/shared/types';
33
import CTA from '../common/CTA';
44

55
const Hero = (props: { data: HeroProps }) => {
@@ -18,8 +18,8 @@ const Hero = (props: { data: HeroProps }) => {
1818
<div className="mx-auto max-w-3xl">
1919
{subtitle && <p className="mb-6 text-xl font-normal text-gray-600 dark:text-slate-400">{subtitle}</p>}
2020
<div className="flex max-w-none flex-col flex-nowrap gap-4 px-4 sm:flex-row sm:justify-center">
21-
<CTA data={callToAction as CallToAction} />
22-
<CTA data={callToAction2 as CallToAction} />
21+
{callToAction && <CTA data={callToAction} />}
22+
{callToAction2 && <CTA data={callToAction2} />}
2323
</div>
2424
</div>
2525
</div>

src/components/widgets/Hero2.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Image from 'next/image';
2-
import { CallToAction, HeroProps } from '~/shared/types';
2+
import { HeroProps } from '~/shared/types';
33
import CTA from '../common/CTA';
44

55
const Hero2 = (props: { data: HeroProps }) => {
@@ -19,8 +19,8 @@ const Hero2 = (props: { data: HeroProps }) => {
1919
<div className="mx-auto max-w-3xl">
2020
{subtitle && <p className="mb-8 text-xl font-normal text-gray-600 dark:text-slate-400">{subtitle}</p>}
2121
<div className="flex max-w-none flex-col flex-nowrap justify-center gap-4 sm:flex-row md:m-0 md:justify-start">
22-
<CTA data={callToAction as CallToAction} />
23-
<CTA data={callToAction2 as CallToAction} />
22+
{callToAction && <CTA data={callToAction} />}
23+
{callToAction2 && <CTA data={callToAction2} />}
2424
</div>
2525
</div>
2626
</div>

0 commit comments

Comments
 (0)