Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoplay-gallery): add autoplay to gallery in showcase mode #656

Merged
merged 4 commits into from
Sep 24, 2020

Conversation

KatvonRivia
Copy link
Member

@KatvonRivia KatvonRivia commented Sep 23, 2020

closes #638


if (currentSlide?.images && currentSlide.type === SlideType.Image) {
delay = delay * currentSlide.images.length;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line

@@ -15,6 +17,7 @@ export const useStoryNavigation = () => {
let autoPlayLink = null;
let nextSlideLink = null;
let previousSlideLink = null;
let delay = 3000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool if this value is defined in the config file

@@ -27,6 +32,15 @@ const StoryMedia: FunctionComponent<Props> = ({
const showPrevButton = currentIndex > 0;
const showNextButton = currentIndex < images.length - 1;

useInterval(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the interval function is called every 3 seconds also in non showcase stories. Better put the mode === StoryMode.Showcase check into the delay. If the delay is null the function will not be triggered.

Like:

delay = mode === StoryMode.Showcase ? 3000 : null


import styles from './story-media.styl';

interface Props {
images: string[];
imageCaptions?: string[];
storyId: string;
mode: StoryMode | null;
}

const StoryMedia: FunctionComponent<Props> = ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing but not related to this PR. It's a bit confusing that this component is called StoryMedia and not sth like StoryGallery or StoryImages. At first I thought StoryMedia is a wrapper component for images and videos etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will rename it in a different PR. 👍

@KatvonRivia KatvonRivia merged commit a5033e0 into develop Sep 24, 2020
@KatvonRivia KatvonRivia deleted the feat/autoplay-gallery branch September 24, 2020 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Presenter mode: gallery
2 participants