code-hike / codehike

Marvellous code walkthroughs
https://codehike.org
MIT License
4.39k stars 135 forks source link

Enhancement: Allow CH.Slideshow to be initialized with a specific slide number #246

Closed brianespinosa closed 1 year ago

brianespinosa commented 1 year ago

It would be great to be able to opt in to letting CH.Slideshow set the current slide in the URL via query params and also initialize slide based on this query param. The use case I am thinking of here is if someone is using codehike for a talk, if they needed to refresh the page, or if they wanted to publish slides after a talk, links to a specific slide could be shared.

This should likely only be opt-in functionality as I know it is possible to have multiple Slideshow components on a page.

brianespinosa commented 1 year ago

Happy to take a look at throwing a PR up for this one as well if you think this would be in-scope for the Slideshow component.

pomber commented 1 year ago

Not sure about this one, I don't want to couple the component to the URL.

But maybe you can pass the starting slide index as a prop to the mdx, and then pass it to <CH.Slideshow start={props.slideIndex}/> (that start prop doesn't exist currently)

brianespinosa commented 1 year ago

That makes sense. Would make it possible to achieve the same thing without bloating the API and introducing external dependencies or dependencies on the platform.

I could put something together along these lines instead later today.

github-actions[bot] commented 1 year ago

:rocket: Issue was released in v0.7.3 :rocket: