Skip to content

Commit 719b0ed

Browse files
authored
feat: allow to disable image slider inside media component (#887)
* feat: allow to disable image slider inside media component
1 parent e4d180f commit 719b0ed

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/components/Media/Image/Image.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,20 @@ export const defaultAnimatedDivQa = 'animated-div';
3434
const Image = (props: ImageAllProps) => {
3535
const {
3636
parallax,
37-
image,
3837
height,
3938
imageClassName,
4039
isBackground,
4140
hasVideoFallback,
4241
video,
4342
fullscreen,
43+
disableImageSliderForArrayInput,
4444
qa,
4545
onLoad,
4646
} = props;
47+
const image =
48+
Array.isArray(props.image) && disableImageSliderForArrayInput
49+
? props.image[0]
50+
: props.image;
4751

4852
const qaAttributes = getQaAttrubutes(
4953
qa,

src/components/Media/Media.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const Media = (props: MediaAllProps) => {
3737
imageClassName,
3838
videoClassName,
3939
youtubeClassName,
40+
disableImageSliderForArrayInput,
4041
playVideo = true,
4142
isBackground,
4243
playButton,
@@ -62,6 +63,7 @@ export const Media = (props: MediaAllProps) => {
6263
key="image"
6364
parallax={parallax}
6465
image={image}
66+
disableImageSliderForArrayInput={disableImageSliderForArrayInput}
6567
height={height}
6668
imageClassName={imageClassName}
6769
isBackground={isBackground}
@@ -129,6 +131,7 @@ export const Media = (props: MediaAllProps) => {
129131
dataLens,
130132
iframe,
131133
parallax,
134+
disableImageSliderForArrayInput,
132135
height,
133136
imageClassName,
134137
isBackground,

src/models/constructor-items/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export interface MediaComponentImageProps {
252252
video?: MediaVideoProps;
253253
parallax?: boolean;
254254
height?: number;
255+
disableImageSliderForArrayInput?: boolean;
255256
}
256257

257258
export interface MediaComponentDataLensProps {

src/schema/validators/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,9 @@ export const MediaProps = {
590590
{type: 'array', items: ImageProps, optionName: 'list'},
591591
],
592592
},
593+
disableImageSliderForArrayInput: {
594+
type: 'boolean',
595+
},
593596
video: VideoProps,
594597
youtube: {
595598
type: 'string',

0 commit comments

Comments
 (0)