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

Add previous / next iteration buttons #418

Merged
merged 1 commit into from Jan 13, 2021
Merged

Conversation

kntsoriano
Copy link
Contributor

No description provided.

Comment on lines +27 to +42
<button
type="button"
aria-label="Go to previous iteration"
onClick={() => onClick(iterations[currentIndex - 1])}
disabled={iterations[0] === current}
>
Previous
</button>
<button
type="button"
aria-label="Go to next iteration"
onClick={() => onClick(iterations[currentIndex + 1])}
disabled={iterations[iterations.length - 1] === current}
>
Next
</button>
Copy link
Member

Choose a reason for hiding this comment

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

This is fine but this is technically pagination and thus it could be implemented as:

<a
  href={urlThatGoesThere}
  onClick={handlerThatPreventsDefaultAndGoesThere}
  rel="next"

That way, users can mid or right click and store the url to the iteration.

Also, you probably want to focus the new/linked iteration after "opening" it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SleeplessByte I'd like to do this as well. What's a good approach to update the URL link once we click on the button?

I'm merging this PR in for now, and I'll open a separate PR to do that.

@kntsoriano kntsoriano merged commit 3c78998 into master Jan 13, 2021
@kntsoriano kntsoriano deleted the prev-next-buttons branch January 13, 2021 22:45
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.

None yet

4 participants