@@ -38,7 +60,7 @@ const FullscreenImage = (props: FullscreenImageProps) => {
onClick={openModal}
style={imageStyle}
/>
-
diff --git a/src/components/Media/Image/Image.tsx b/src/components/Media/Image/Image.tsx
index 1ecce074f..95c89ed56 100644
--- a/src/components/Media/Image/Image.tsx
+++ b/src/components/Media/Image/Image.tsx
@@ -3,11 +3,11 @@ import React, {Fragment, useEffect, useState} from 'react';
import {Interpolation, animated, config, useSpring} from '@react-spring/web';
import debounce from 'lodash/debounce';
-import SliderBlock from '../../../blocks/Slider/Slider';
+import {SliderBlock} from '../../../blocks';
import {ImageProps, MediaComponentImageProps, QAProps, SliderType} from '../../../models';
import {block, getQaAttrubutes} from '../../../utils';
import BackgroundImage from '../../BackgroundImage/BackgroundImage';
-import FullscreenImage from '../../FullscreenImage/FullscreenImage';
+import FullscreenImage, {FullscreenImageProps} from '../../FullscreenImage/FullscreenImage';
import ImageView from '../../Image/Image';
import {getMediaImage} from './utils';
@@ -20,6 +20,7 @@ export interface ImageAdditionProps {
imageClassName?: string;
isBackground?: boolean;
fullscreen?: boolean;
+ fullscreenClassName?: string;
onLoad?: () => void;
}
@@ -36,6 +37,7 @@ const Image = (props: ImageAllProps) => {
parallax,
height,
imageClassName,
+ fullscreenClassName,
isBackground,
hasVideoFallback,
video,
@@ -87,7 +89,10 @@ const Image = (props: ImageAllProps) => {
const imageClass = b('item', {withVideo: Boolean(video) && !hasVideoFallback}, imageClassName);
- const renderFullscreenImage = (item: ImageProps) => {
+ const renderFullscreenImage = (
+ item: ImageProps,
+ sliderData?: FullscreenImageProps['sliderData'],
+ ) => {
const itemData = getMediaImage(item);
return (
@@ -95,8 +100,10 @@ const Image = (props: ImageAllProps) => {
key={itemData.alt}
{...itemData}
imageClassName={imageClass}
+ modalImageClass={fullscreenClassName}
imageStyle={{height}}
qa={qaAttributes.fullscreenImage}
+ sliderData={sliderData}
/>
);
};
@@ -135,7 +142,9 @@ const Image = (props: ImageAllProps) => {
{imageArray.map((item, index) => (
- {fullscreenItem ? renderFullscreenImage(item) : imageOnly(item)}
+ {fullscreenItem
+ ? renderFullscreenImage(item, {items: imageArray, initialIndex: index})
+ : imageOnly(item)}
))}
diff --git a/src/components/Media/Media.scss b/src/components/Media/Media.scss
index af4b8fec0..5d71bc38b 100644
--- a/src/components/Media/Media.scss
+++ b/src/components/Media/Media.scss
@@ -13,4 +13,9 @@ $block: '.#{$ns}Media';
display: flex;
align-items: center;
}
+
+ &__fullscreen-image-cover {
+ object-fit: cover;
+ object-position: top;
+ }
}
diff --git a/src/components/Media/Media.tsx b/src/components/Media/Media.tsx
index 1a3fa02e4..9dd31affa 100644
--- a/src/components/Media/Media.tsx
+++ b/src/components/Media/Media.tsx
@@ -18,6 +18,7 @@ const b = block('Media');
export interface MediaAllProps extends MediaProps, VideoAdditionProps, ImageAdditionProps, QAProps {
className?: string;
+ isFullscreenImageCover?: boolean;
youtubeClassName?: string;
autoplay?: boolean;
onImageLoad?: () => void;
@@ -35,6 +36,7 @@ export const Media = (props: MediaAllProps) => {
previewImg,
parallax = false,
fullscreen,
+ isFullscreenImageCover,
analyticsEvents,
className,
imageClassName,
@@ -71,6 +73,9 @@ export const Media = (props: MediaAllProps) => {
disableImageSliderForArrayInput={disableImageSliderForArrayInput}
height={height}
imageClassName={imageClassName}
+ fullscreenClassName={
+ isFullscreenImageCover ? b('fullscreen-image-cover') : undefined
+ }
isBackground={isBackground}
video={video}
hasVideoFallback={hasVideoFallback}
@@ -144,6 +149,7 @@ export const Media = (props: MediaAllProps) => {
isBackground,
hasVideoFallback,
fullscreen,
+ isFullscreenImageCover,
qaAttributes.image,
qaAttributes.video,
onImageLoad,
diff --git a/src/constructor-items.ts b/src/constructor-items.ts
index 3bb5c4a7d..4def4f18f 100644
--- a/src/constructor-items.ts
+++ b/src/constructor-items.ts
@@ -16,10 +16,10 @@ import {
QuestionsBlock,
ShareBlock,
SliderBlock,
+ SliderOldBlock,
TableBlock,
TabsBlock,
} from './blocks';
-import {SliderNewBlock} from './blocks/unstable';
import {BlockType, NavigationItemType, SubBlockType} from './models';
import {
GithubButton,
@@ -43,7 +43,7 @@ import {
} from './sub-blocks';
export const blockMap = {
- [BlockType.SliderBlock]: SliderBlock,
+ [BlockType.SliderOldBlock]: SliderOldBlock,
[BlockType.ExtendedFeaturesBlock]: ExtendedFeaturesBlock,
[BlockType.PromoFeaturesBlock]: PromoFeaturesBlock,
[BlockType.QuestionsBlock]: QuestionsBlock,
@@ -62,8 +62,7 @@ export const blockMap = {
[BlockType.MapBlock]: MapBlock,
[BlockType.FilterBlock]: FilterBlock,
[BlockType.FormBlock]: FormBlock,
- // unstable
- [BlockType.SliderNewBlock]: SliderNewBlock,
+ [BlockType.SliderBlock]: SliderBlock,
};
export const subBlockMap = {
diff --git a/src/editor/data/templates/slider-new-block.json b/src/editor/data/templates/slider-old-block.json
similarity index 98%
rename from src/editor/data/templates/slider-new-block.json
rename to src/editor/data/templates/slider-old-block.json
index d3670d16f..f337b8a5e 100644
--- a/src/editor/data/templates/slider-new-block.json
+++ b/src/editor/data/templates/slider-old-block.json
@@ -1,8 +1,8 @@
{
"template": {
- "type": "slider-new-block",
+ "type": "slider-old-block",
"title": {
- "text": "Slider new",
+ "text": "Slider",
"url": "https://example.com"
},
"children": [
diff --git a/src/models/constructor-items/blocks.ts b/src/models/constructor-items/blocks.ts
index 715d0f235..e4fc200bc 100644
--- a/src/models/constructor-items/blocks.ts
+++ b/src/models/constructor-items/blocks.ts
@@ -44,6 +44,8 @@ import {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub
export enum BlockType {
PromoFeaturesBlock = 'promo-features-block',
ExtendedFeaturesBlock = 'extended-features-block',
+ /** @deprecated */
+ SliderOldBlock = 'slider-old-block',
SliderBlock = 'slider-block',
QuestionsBlock = 'questions-block',
BannerBlock = 'banner-block',
@@ -61,8 +63,6 @@ export enum BlockType {
MapBlock = 'map-block',
FilterBlock = 'filter-block',
FormBlock = 'form-block',
- // unstable
- SliderNewBlock = 'slider-new-block',
}
export const BlockTypes = Object.values(BlockType);
@@ -108,12 +108,13 @@ export enum SliderBreakpointNames {
export enum SliderType {
MediaCard = 'media-card',
HeaderCard = 'header-card',
+ FullscreenCard = 'fullscreen-card',
}
export type SliderBreakpointParams = Record
;
export type SlidesToShow = Partial | number;
-export interface SliderProps extends Childable, Animatable, LoadableChildren {
+export interface SliderOldProps extends Childable, Animatable, LoadableChildren {
dots?: boolean;
arrows?: boolean;
slidesToShow?: SlidesToShow;
@@ -129,7 +130,7 @@ export interface SliderProps extends Childable, Animatable, LoadableChildren {
adaptive?: boolean;
}
-export interface SliderNewProps extends Childable, Animatable, LoadableChildren {
+export interface SliderProps extends Childable, Animatable, LoadableChildren {
dots?: boolean;
arrows?: boolean;
slidesToShow?: SlidesToShow;
@@ -142,9 +143,10 @@ export interface SliderNewProps extends Childable, Animatable, LoadableChildren
autoplay?: number;
//for server transforms
randomOrder?: boolean;
+ adaptive?: boolean;
}
-export interface HeaderSliderBlockProps extends Omit {
+export interface HeaderSliderBlockProps extends Omit {
items: HeaderBlockProps[];
}
@@ -457,9 +459,9 @@ export type HeaderBlockModel = {
type: BlockType.HeaderBlock;
} & HeaderBlockProps;
-export type SliderBlockModel = {
- type: BlockType.SliderBlock;
-} & SliderProps;
+export type SliderOldBlockModel = {
+ type: BlockType.SliderOldBlock;
+} & SliderOldProps;
export type ExtendedFeaturesBlockModel = {
type: BlockType.ExtendedFeaturesBlock;
@@ -529,12 +531,12 @@ export type FormBlockModel = {
type: BlockType.FormBlock;
} & FormBlockProps;
-// unstable block models
-export type SliderNewBlockModel = {
- type: BlockType.SliderNewBlock;
-} & SliderNewProps;
+export type SliderBlockModel = {
+ type: BlockType.SliderBlock;
+} & SliderProps;
type BlockModels =
+ | SliderOldBlockModel
| SliderBlockModel
| ExtendedFeaturesBlockModel
| PromoFeaturesBlockModel
@@ -555,6 +557,4 @@ type BlockModels =
| FilterBlockModel
| FormBlockModel;
-type UnstableBlockModels = SliderNewBlockModel;
-
-export type Block = (BlockModels | UnstableBlockModels) & BlockBaseProps;
+export type Block = BlockModels & BlockBaseProps;
diff --git a/src/schema/constants.ts b/src/schema/constants.ts
index 63d4b62a5..94450cabf 100644
--- a/src/schema/constants.ts
+++ b/src/schema/constants.ts
@@ -19,7 +19,7 @@ import {
QuestionsBlock,
ShareBlock,
SliderBlock,
- SliderNewBlock,
+ SliderOldBlock,
TableBlock,
TabsBlock,
} from './validators/blocks';
@@ -38,7 +38,7 @@ export const blockSchemas: Record = {
...Divider,
...ExtendedFeaturesBlock,
...PromoFeaturesBlock,
- ...SliderBlock,
+ ...SliderOldBlock,
...QuestionsBlock,
...HeaderBlock,
...BannerBlock,
@@ -55,7 +55,7 @@ export const blockSchemas: Record = {
...ShareBlock,
...FilterBlock,
...FormBlock,
- ...SliderNewBlock,
+ ...SliderBlock,
};
export const cardSchemas = {
@@ -76,6 +76,8 @@ export const constructorBlockSchemaNames = [
'post',
'extended-features-block',
'promo-features-block',
+ /** @deprecated */
+ 'slider-old-block',
'slider-block',
'questions-block',
'header-block',
diff --git a/src/schema/validators/blocks.ts b/src/schema/validators/blocks.ts
index ca30f4929..f48b1cd11 100644
--- a/src/schema/validators/blocks.ts
+++ b/src/schema/validators/blocks.ts
@@ -7,7 +7,7 @@ export * from '../../blocks/Info/schema';
export * from '../../blocks/Media/schema';
export * from '../../blocks/Map/schema';
export * from '../../blocks/Questions/schema';
-export * from '../../blocks/Slider/schema';
+export * from '../../blocks/SliderOld/schema';
export * from '../../blocks/Table/schema';
export * from '../../blocks/Tabs/schema';
export * from '../../blocks/HeaderSlider/schema';
@@ -17,4 +17,4 @@ export * from '../../blocks/ContentLayout/schema';
export * from '../../blocks/Share/schema';
export * from '../../blocks/FilterBlock/schema';
export * from '../../blocks/Form/schema';
-export * from '../../blocks/SliderNew/schema';
+export * from '../../blocks/Slider/schema';
diff --git a/src/sub-blocks/MediaCard/__tests__/MediaCard.visual.test.tsx b/src/sub-blocks/MediaCard/__tests__/MediaCard.visual.test.tsx
index 467e49123..3fa6e08db 100644
--- a/src/sub-blocks/MediaCard/__tests__/MediaCard.visual.test.tsx
+++ b/src/sub-blocks/MediaCard/__tests__/MediaCard.visual.test.tsx
@@ -21,7 +21,7 @@ test.describe('MediaCard', () => {
await expectScreenshot({skipTheme: 'dark'});
});
- test('render stories ', async ({mount, expectScreenshot, delay}) => {
+ test.skip('render stories ', async ({mount, expectScreenshot, delay}) => {
await mount();
await delay(DEFAULT_MEDIACARD_DELAY);
await expectScreenshot({skipTheme: 'dark'});
diff --git a/src/text-transform/config.ts b/src/text-transform/config.ts
index 3b9e7e720..bbb69a8a3 100644
--- a/src/text-transform/config.ts
+++ b/src/text-transform/config.ts
@@ -229,7 +229,7 @@ export const config: BlocksConfig = {
parser: parsePromoFeatures,
},
],
- [BlockType.SliderBlock]: blockHeaderTransformer,
+ [BlockType.SliderOldBlock]: blockHeaderTransformer,
[BlockType.CompaniesBlock]: blockHeaderTransformer,
[BlockType.QuestionsBlock]: [
{
diff --git a/src/widget/styles.scss b/src/widget/styles.scss
index 7a17f9ab7..7745dd8f9 100644
--- a/src/widget/styles.scss
+++ b/src/widget/styles.scss
@@ -1 +1,2 @@
@import '../../styles/styles.scss';
+@import '../../styles/fonts.scss';
diff --git a/styles/fonts.scss b/styles/fonts.scss
new file mode 100644
index 000000000..637a6e1cd
--- /dev/null
+++ b/styles/fonts.scss
@@ -0,0 +1 @@
+@import '@gravity-ui/uikit/styles/fonts.css';
diff --git a/styles/styles.scss b/styles/styles.scss
index 5c2a8d3e0..2b3d63c5b 100644
--- a/styles/styles.scss
+++ b/styles/styles.scss
@@ -1,4 +1,3 @@
-@import '@gravity-ui/uikit/styles/fonts.css';
@import '~@gravity-ui/uikit/styles/styles.css';
@import './mixins.scss';
@import './variables.scss';
diff --git a/styles/variables.scss b/styles/variables.scss
index c8682cf53..d4882bc14 100644
--- a/styles/variables.scss
+++ b/styles/variables.scss
@@ -57,3 +57,4 @@ $gridGutterMobile: 8px;
$contentWidth: calc(#{$newContentWidth} + #{$gridGutter} * 2 + #{$gridContainerPadding} * 2);
$gridContainerMargin: 16px;
+$fullscreenImageMobilePadding: 8px;