alangdm/helium-animated-pages

allow selectPrevious() to be the real previous page

Closed this issue · 2 comments

Hi,

As a feedback let me first thank you for this great job, I was looking for an alternative to the deprecated neon-animated-pages and found your component to be a serious candidate.

I'm experiencing your component for a PWA, mobile-first, app and transitions between pages are working well (as expected). I wonder though how can I implement a page navigation feature. Typically I would like my user to be able to go back to the previous page, not the previous sibling of the current page but the one (of many possibilities) that bring him to the current page.

Let's say I have a Detail Page that describes an item, that page can be triggered by selecting an item from a Search Page or a Saved Item Page. It would be great if the selectPreivous() method (or something else) could redirect back to the real previous page.

Regards

Hi, first of all, thanks for your feedback!

Now, as far as what you mention, sure, doing it wouldn't be that hard, I mean, I could just store the previous page or have a "history" stack of sorts, however, I don't really think that's part of the scope of this component.

If you look at how neon-animated-pages works (which is what I based this upon), it only handles the transition animations and that's pretty much it, the selectPrevious() and selectNext() methods are mostly there to implement a "slideshow" of sorts.

And I actually think you can already do what you need by using a router like say vaadin router, pwa-helpers' router, app-route or pretty much any other js router for SPAs, I've been using pwa-helper's router in my pwa projects and it works just as expected.

If you really don't want to use a router then maybe you could have some sort of history stack of the pages you've navigated through?

Anyway, I might be wrong and maybe there's some merit I'm not seeing so far in implementing something like what you mention here, please tell me what you think

I was confused by the name of those selectPrevious() and selectNext() methods which, to me, were functionally disturbing as they refer to the DOM elements and not the user navigation. But I get the point when you are saying that it is behond the scope of this component and I also understand the purpose of those methods now.

I've ended up managning it with a stacked history.
Thank you!