-
Notifications
You must be signed in to change notification settings - Fork 12
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
component: prev/next navigation #280
Conversation
This component takes the list of resources of a collection, creates a flat array of all the resources to find the previous and next pages to display below a post.
✅ Deploy Preview for bump-content-hub ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
I left a tiny suggestions, but LGTM
@@ -0,0 +1,14 @@ | |||
<page-navigation> | |||
<% if @previous.present? %> |
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.
Just asking... We don't need test on @previous.resource.relative_url
and @previous.label
presence ?
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.
resource
is a Bridgetown class that always have a relative_url
and label
also always exist as a menu entry name.
pages = [] | ||
get_resources(@entries, pages) |
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.
I would create a logic to set
pages = [] | |
get_resources(@entries, pages) | |
pages = get_pages(@entries) |
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.
As discussed LGTM like this.
If you want, just for culture, we can pair later to test the other way of writing get_resources
logic.
This component takes the list of resources of a collection, creates a flat array of all the resources to find the previous and next pages to display below a post.
It should be integrated in the upcoming OpenAPI guides and will look like this: