lsirivong / gatsby-plugin-modal-routing

A gatsby plugin for routable modals
44 stars 30 forks source link

Is there a way to navigate to next/prev modals as in the gatsbygram example? #43

Closed ilia-luk closed 4 years ago

ilia-luk commented 4 years ago

Firstly, let me say that this plugin works great, I found it after following a few hacky tutorials which tried to implement something similar without any success, and now I can't be happier from the result.

The thing is, I've checked out the second example you referenced:

https://gatsbygram-with-gatsby-plugin-modal-routing.netlify.com/

and I've noticed there are navigation links between modals, I tried to find instructions on this but without success, I checked out the repository, looked around and strangely it doesn't use the plugin, which makes me wonder why do you use it as an example?

so my questions are:

lsirivong commented 4 years ago

Yes!

The correct source for the gatsbygram example is here: https://github.com/lsirivong/gatsbygram-with-gatsby-plugin-modal-routing

Here's how it's navigating previous / next: https://github.com/lsirivong/gatsbygram-with-gatsby-plugin-modal-routing/blob/master/src/components/modal.js#L72

I'll update the gatsbygram example so that it links to the correct source!

You can also see in the other example that when you open a model link while already in a modal, it will load in the existing modal, so you don't necessarily have to do it with navigate like in the gatsbygram example: https://github.com/lsirivong/gatsby-starter-with-gatsby-plugin-modal-routing/blob/master/src/pages/page-2.js#L15