diff --git a/src/blocks/Banner/__stories__/Banner.mdx b/src/blocks/Banner/__stories__/Banner.mdx index 174d76a2b..4013df817 100644 --- a/src/blocks/Banner/__stories__/Banner.mdx +++ b/src/blocks/Banner/__stories__/Banner.mdx @@ -20,4 +20,7 @@ import * as BannerStories from './Banner.stories.tsx'; `color?: string` — Background color `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/blocks/Header/__stories__/Header.mdx b/src/blocks/Header/__stories__/Header.mdx index f491d67ef..420be0f1b 100644 --- a/src/blocks/Header/__stories__/Header.mdx +++ b/src/blocks/Header/__stories__/Header.mdx @@ -47,4 +47,4 @@ There could be only one one Header block on the page. `verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl'` — Top and bottom offsets from the text. (Values: '0' - 0px, 's' - 48px, 'm' - 80px, 'l' - 112px, 'xl' - 144px.) -`mediaView?: full | fit` — full is default value, the media content covers all widht and height. Fit - media content has real sizes and locates in the middle +`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/blocks.ts b/src/models/constructor-items/blocks.ts index ec5d2fc71..2a5028da5 100644 --- a/src/models/constructor-items/blocks.ts +++ b/src/models/constructor-items/blocks.ts @@ -28,6 +28,7 @@ import { MapProps, MediaDirection, MediaProps, + MediaView, TextSize, TextTheme, ThemedImage, @@ -159,7 +160,7 @@ export interface HeaderBlockProps { offset?: HeaderOffset; image?: ThemedImage; video?: ThemedMediaVideoProps; - mediaView?: 'fit' | 'full'; + mediaView?: MediaView; background?: ThemedHeaderBlockBackground; theme?: 'light' | 'dark'; verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl'; diff --git a/src/models/constructor-items/common.ts b/src/models/constructor-items/common.ts index d702499bf..b7ca07989 100644 --- a/src/models/constructor-items/common.ts +++ b/src/models/constructor-items/common.ts @@ -386,6 +386,8 @@ export interface TitleItemBaseProps { onClick?: () => void; } +export type MediaView = 'fit' | 'full'; + // card export type MediaBorder = 'shadow' | 'line' | 'none'; export type CardBorder = MediaBorder; diff --git a/src/models/constructor-items/sub-blocks.ts b/src/models/constructor-items/sub-blocks.ts index 4910e9c1e..2ea1d2458 100644 --- a/src/models/constructor-items/sub-blocks.ts +++ b/src/models/constructor-items/sub-blocks.ts @@ -15,6 +15,7 @@ import { ImageProps, LinkProps, MediaProps, + MediaView, PriceDetailedProps, TextTheme, Themable, @@ -143,7 +144,8 @@ export interface BannerCardProps { disableCompress?: boolean; color?: ThemeSupporting; theme?: TextTheme; - button: Pick; + button: Pick; + mediaView?: MediaView; } export interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {} diff --git a/src/sub-blocks/BannerCard/BannerCard.scss b/src/sub-blocks/BannerCard/BannerCard.scss index eba48c72c..5db86b3e2 100644 --- a/src/sub-blocks/BannerCard/BannerCard.scss +++ b/src/sub-blocks/BannerCard/BannerCard.scss @@ -84,6 +84,14 @@ $block: '.#{$ns}banner-card'; } } + &_media-view_fit { + #{$block}__image { + img { + object-fit: contain; + } + } + } + @media (max-width: map-get($gridBreakpoints, 'sm') - 1) { &__image { display: none; diff --git a/src/sub-blocks/BannerCard/BannerCard.tsx b/src/sub-blocks/BannerCard/BannerCard.tsx index 38966ab6b..482bfce0f 100644 --- a/src/sub-blocks/BannerCard/BannerCard.tsx +++ b/src/sub-blocks/BannerCard/BannerCard.tsx @@ -13,11 +13,12 @@ export const BannerCard = (props: BannerCardProps) => { const { title, subtitle, - button: {url, text, target}, + button: {url, text, target, theme: buttonTheme = 'raised'}, color, theme: textTheme = 'light', image, disableCompress, + mediaView = 'full', } = props; const theme = useTheme(); const contentStyle: Record = {}; @@ -27,7 +28,7 @@ export const BannerCard = (props: BannerCardProps) => { } return ( -
+
@@ -45,7 +46,7 @@ export const BannerCard = (props: BannerCardProps) => {