Skip to content

Commit

Permalink
feat: allow to disable image slider inside media component (#887) (#891)
Browse files Browse the repository at this point in the history
* feat: allow to disable image slider inside media component
  • Loading branch information
benax-se authored Apr 2, 2024
1 parent 122d0eb commit 84be439
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Media/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ export const defaultAnimatedDivQa = 'animated-div';
const Image = (props: ImageAllProps) => {
const {
parallax,
image,
height,
imageClassName,
isBackground,
hasVideoFallback,
video,
fullscreen,
disableImageSliderForArrayInput,
qa,
onLoad,
} = props;
const image =
Array.isArray(props.image) && disableImageSliderForArrayInput
? props.image[0]
: props.image;

const qaAttributes = getQaAttrubutes(
qa,
Expand Down
3 changes: 3 additions & 0 deletions src/components/Media/Media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Media = (props: MediaAllProps) => {
imageClassName,
videoClassName,
youtubeClassName,
disableImageSliderForArrayInput,
playVideo = true,
isBackground,
playButton,
Expand All @@ -63,6 +64,7 @@ export const Media = (props: MediaAllProps) => {
key="image"
parallax={parallax}
image={image}
disableImageSliderForArrayInput={disableImageSliderForArrayInput}
height={height}
imageClassName={imageClassName}
isBackground={isBackground}
Expand Down Expand Up @@ -131,6 +133,7 @@ export const Media = (props: MediaAllProps) => {
dataLens,
iframe,
parallax,
disableImageSliderForArrayInput,
height,
imageClassName,
isBackground,
Expand Down
1 change: 1 addition & 0 deletions src/models/constructor-items/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export interface MediaComponentImageProps {
video?: MediaVideoProps;
parallax?: boolean;
height?: number;
disableImageSliderForArrayInput?: boolean;
}

export interface MediaComponentDataLensProps {
Expand Down
3 changes: 3 additions & 0 deletions src/schema/validators/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ export const MediaProps = {
{type: 'array', items: ImageProps, optionName: 'list'},
],
},
disableImageSliderForArrayInput: {
type: 'boolean',
},
video: VideoProps,
youtube: {
type: 'string',
Expand Down

0 comments on commit 84be439

Please sign in to comment.