-
Notifications
You must be signed in to change notification settings - Fork 19
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
Showing
10 changed files
with
103 additions
and
5 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,57 @@ | ||
import Image from 'next/image' | ||
import ButtonLink from '../shared/ButtonLink' | ||
|
||
type Image = { | ||
fields: { | ||
title?: string | ||
file: { | ||
url: string | ||
} | ||
} | ||
} | ||
|
||
type CtaData = { | ||
title: string | ||
description?: string | ||
linkPath: string | ||
linkText: string | ||
image?: Image | null | ||
} | ||
|
||
const CallToAction = ({ data }: { data: CtaData }) => { | ||
const { linkPath, linkText, description, image, title } = data | ||
const imageSrc = image?.fields?.file?.url | ||
const imageAlt = image?.fields?.title || 'CTA Image' | ||
const isExtenalLink = linkPath.includes('http') | ||
return ( | ||
<span className="bg-th-bkg-1 border border-th-bkg-4 p-4 md:px-6 rounded-lg flex flex-col md:flex-row md:items-center md:justify-between my-4"> | ||
<span className="flex items-center space-x-3"> | ||
{imageSrc ? ( | ||
<Image | ||
className="flex-shrink-0" | ||
src={`https:${imageSrc}`} | ||
alt={imageAlt} | ||
height={56} | ||
width={56} | ||
/> | ||
) : null} | ||
<span> | ||
<span className="text-th-fgd-2 text-base block font-display"> | ||
{title} | ||
</span> | ||
<span className="text-sm block text-th-fgd-2">{description}</span> | ||
</span> | ||
</span> | ||
<span className="flex space-x-2 md:pl-4 pt-4 md:pt-0"> | ||
<ButtonLink | ||
linkText={linkText} | ||
path={linkPath} | ||
size="small" | ||
target={isExtenalLink ? '_blank' : undefined} | ||
/> | ||
</span> | ||
</span> | ||
) | ||
} | ||
|
||
export default CallToAction |
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,24 @@ | ||
import type { | ||
ChainModifiers, | ||
Entry, | ||
EntryFieldTypes, | ||
EntrySkeletonType, | ||
LocaleCode, | ||
} from 'contentful' | ||
|
||
export interface TypeCallToActionFields { | ||
title: EntryFieldTypes.Symbol | ||
description?: EntryFieldTypes.Symbol | ||
linkPath: EntryFieldTypes.Symbol | ||
linkText: EntryFieldTypes.Symbol | ||
image?: EntryFieldTypes.AssetLink | ||
} | ||
|
||
export type TypeCallToActionSkeleton = EntrySkeletonType< | ||
TypeCallToActionFields, | ||
'callToAction' | ||
> | ||
export type TypeCallToAction< | ||
Modifiers extends ChainModifiers, | ||
Locales extends LocaleCode, | ||
> = Entry<TypeCallToActionSkeleton, Modifiers, Locales> |
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
Large diffs are not rendered by default.
Oops, something went wrong.