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

component: prev/next navigation #280

Merged
merged 1 commit into from
Sep 4, 2024
Merged

component: prev/next navigation #280

merged 1 commit into from
Sep 4, 2024

Conversation

thimy
Copy link
Member

@thimy thimy commented Sep 3, 2024

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:
image

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.
@thimy thimy requested a review from fbraure September 3, 2024 09:15
@thimy thimy self-assigned this Sep 3, 2024
Copy link

netlify bot commented Sep 3, 2024

Deploy Preview for bump-content-hub ready!

Name Link
🔨 Latest commit ef0fa3a
🔍 Latest deploy log https://app.netlify.com/sites/bump-content-hub/deploys/66d6d3bae4b85800084af1f1
😎 Deploy Preview https://deploy-preview-280--bump-content-hub.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@fbraure fbraure left a 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? %>
Copy link
Contributor

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 ?

Copy link
Member Author

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.

src/_components/shared/page_navigation.rb Show resolved Hide resolved
Comment on lines +10 to +11
pages = []
get_resources(@entries, pages)
Copy link
Contributor

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

Suggested change
pages = []
get_resources(@entries, pages)
pages = get_pages(@entries)

src/_components/shared/page_navigation.rb Show resolved Hide resolved
Copy link
Contributor

@fbraure fbraure left a 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.

src/_components/shared/page_navigation.rb Show resolved Hide resolved
@thimy thimy merged commit 74c2abc into main Sep 4, 2024
5 checks passed
@thimy thimy deleted the prev-next-navigation branch September 4, 2024 12:31
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.

2 participants