From 36cb65f5b9749148bdce107efbcf27cba22bef8b Mon Sep 17 00:00:00 2001 From: aleksey-shkadov Date: Wed, 25 Sep 2024 17:52:40 +0300 Subject: [PATCH] fix: button in banner block is optional (#1033) * fix: button in banner block is optional * fix: button in banner block is optional --------- Co-authored-by: bablos --- src/blocks/Banner/__stories__/Banner.mdx | 2 +- src/models/constructor-items/sub-blocks.ts | 2 +- src/sub-blocks/BannerCard/BannerCard.tsx | 25 ++++++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/blocks/Banner/__stories__/Banner.mdx b/src/blocks/Banner/__stories__/Banner.mdx index 4013df817..916cf84a0 100644 --- a/src/blocks/Banner/__stories__/Banner.mdx +++ b/src/blocks/Banner/__stories__/Banner.mdx @@ -19,7 +19,7 @@ import * as BannerStories from './Banner.stories.tsx'; `color?: string` — Background color -`button: Button` — Button +`button?: Button` — Button `mediaView?: full | fit` — full is default value, the media content covers all width and height. Fit - media content has real sizes and locates in the middle diff --git a/src/models/constructor-items/sub-blocks.ts b/src/models/constructor-items/sub-blocks.ts index 2e48346ec..1d82d9639 100644 --- a/src/models/constructor-items/sub-blocks.ts +++ b/src/models/constructor-items/sub-blocks.ts @@ -162,7 +162,7 @@ export interface BannerCardProps { disableCompress?: boolean; color?: ThemeSupporting; theme?: TextTheme; - button: Pick; + button?: Pick; mediaView?: MediaView; } diff --git a/src/sub-blocks/BannerCard/BannerCard.tsx b/src/sub-blocks/BannerCard/BannerCard.tsx index 482bfce0f..3510a7d2d 100644 --- a/src/sub-blocks/BannerCard/BannerCard.tsx +++ b/src/sub-blocks/BannerCard/BannerCard.tsx @@ -13,7 +13,7 @@ export const BannerCard = (props: BannerCardProps) => { const { title, subtitle, - button: {url, text, target, theme: buttonTheme = 'raised'}, + button: {url, text, target, theme: buttonTheme = 'raised'} = {}, color, theme: textTheme = 'light', image, @@ -43,16 +43,19 @@ export const BannerCard = (props: BannerCardProps) => { /> )} - -