Skip to content

Commit

Permalink
feat: Add on click prop to banner (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio authored Jan 22, 2025
1 parent 37a11d9 commit 29ff52c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const convertAlignmentToFlex = (alignment: Property.TextAlign) => {
export const Banner: React.FC<BannerProps> = (props: BannerProps) => {
const {
isLoading,
onClick,
fields,
assets,
locale = ContentfulLocale.enUS,
Expand All @@ -52,7 +53,7 @@ export const Banner: React.FC<BannerProps> = (props: BannerProps) => {
return null
}

// Build the parameteres based on the size of the screen
// Build the parameters based on the size of the screen
const bannerBackgroundImage = getAssetUrl(
assets,
ContentfulLocale.enUS,
Expand Down Expand Up @@ -99,6 +100,7 @@ export const Banner: React.FC<BannerProps> = (props: BannerProps) => {
fields.buttonsText?.[locale] ? (
<ButtonContainer justifyContent={buttonAlignment}>
<Button
onClick={onClick}
href={fields.buttonLink[ContentfulLocale.enUS]}
variant="contained"
disableElevation
Expand Down
3 changes: 2 additions & 1 deletion src/components/Banner/Banner.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ type BannerProps = {
fields: BannerFields | null
assets: Record<string, ContentfulAsset>
isLoading: boolean
locale?: ContentfulLocale
error: string | null
onClick?: React.MouseEventHandler<HTMLButtonElement>
locale?: ContentfulLocale
}

type LowercasedAlignment = "left" | "center" | "right"
Expand Down

0 comments on commit 29ff52c

Please sign in to comment.