-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
|
||
if (currentSlide?.images && currentSlide.type === SlideType.Image) { | ||
delay = delay * currentSlide.images.length; | ||
} |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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> = ({ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 👍
closes #638