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

feat[#50499]: Add back button and breadcrumbs to page header #45

Merged
merged 28 commits into from
Nov 9, 2023

Conversation

dominic-braeunlein
Copy link

@dominic-braeunlein dominic-braeunlein commented Oct 26, 2023

Work package: https://community.openproject.org/wp/50947

Needed for implementing: https://community.openproject.org/wp/50499
Related PR in OP: opf/openproject#13962

What are you trying to accomplish?

This PR adds breadcrumbs and back button support to the PageHeader.

A breadcrumbs item can be:

  • An object with href and text e.g. {href: "/admin", text: "Admin" }.
  • An Anchor-tag string wich can be the return value from breadcrumb_paths method in BreadcrumbHelper e.g. "\u003ca href=\"/root/sub\"\u003eSub\u003c/a\u003e" .
  • Or a text which is useful for the last element / current url e.g. "Page 2"

This feature also adds an optional show_breadcrumb parameter to deactivate rendering of the breadcrumbs. Which helps harmonisation with the existing BreadcrumbHelper #show_local_breadcrumb control method to maintain backwards compatibility.

e.g.

breadcrumb_items = [
  "test1",
  "test2" ,
  "test3"
]
render(Primer::OpenProject::PageHeader.new) do |header|
  header.with_title() { "Hello" }
  header.with_back_button(href: "#")
  header.with_breadcrumbs(breadcrumb_items, show_breadcrumb: false)
end

Screenshots

Screenshot 2023-10-26 at 14 54 16

List the issues that this change affects.

https://community.openproject.org/wp/50499

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Anything you want to highlight for special attention from reviewers?

Accessibility

  • Fixes axe scan violation - This change fixes an existing axe scan violation.
  • No new axe scan violation - This change does not introduce any new axe scan violations.
  • New axe violation - This change introduces a new axe scan violation. Please describe why the violation cannot be resolved below.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2023

🦋 Changeset detected

Latest commit: 6ce609d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@akabiru akabiru left a comment

Choose a reason for hiding this comment

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

Looks good to me! 🎉 I left a few remarks but would leave to @HDinger for final approval 🥇

app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
previews/primer/open_project/page_header_preview.rb Outdated Show resolved Hide resolved
Copy link
Collaborator

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Hi @dominic-braeunlein

Looks good 👍 I have some remarks in the code, some of them we might want to discuss.

  • Further I noticed that the arrow is not correctly aligned with the header text:
Bildschirmfoto 2023-10-30 um 12 40 53
  • At least some of the CI failures are due to missing specs. So please add tests for the newly added features. You can add them here. Let me know, if you need help with the other failing tests.

app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
static/classes.json Outdated Show resolved Hide resolved
app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
app/components/primer/open_project/page_header.rb Outdated Show resolved Hide resolved
Copy link
Collaborator

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Hi @dominic-braeunlein

Nice job, I only have minor remarks. 👍 Further @bsatarnejad noticed that on mobile the text is not wrapping correctly around the arrow:

Bildschirmfoto 2023-11-02 um 09 28 18

I'd expect the arrow to stay on the right side, and the text to wrap after it. What do you think?

@dominic-braeunlein
Copy link
Author

Hi @dominic-braeunlein

Nice job, I only have minor remarks. 👍 Further @bsatarnejad noticed that on mobile the text is not wrapping correctly around the arrow:

Bildschirmfoto 2023-11-02 um 09 28 18 I'd expect the arrow to stay on the right side, and the text to wrap after it. What do you think?

Hi @HDinger,
thank you! I went for following solution to wrap the title:

Screenshot 2023-11-07 at 19 26 21 Screenshot 2023-11-07 at 19 26 12

I had to change the HTML structure in the PageHeader to achieve this result, which resulted also in CSS changes. Please have a look and let me know if it is ok to have a div in the template.

While I was changing the CSS I saw that the order attributes could be removed now. Please double check this too, maybe I am missing something.

Copy link
Collaborator

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Hi @dominic-braeunlein

I had to change the HTML structure in the PageHeader to achieve this result, which resulted also in CSS changes. Please have a look and let me know if it is ok to have a div in the template.

That is totally okay 👍

While I was changing the CSS I saw that the order attributes could be removed now. Please double check this too, maybe I am missing something.

Yes, seems to work fine 👍

The component looks good to me. I have some minor remarks with regards to the preview.
Further, I had a look on the figma specification and saw that there are some special mobile styles: The back button is hidden, as well as the breadcumb and a different navigation element is shown. In Primer, this is named the context bar of the page header. We can add that in a separate PR to get this one done, but need to keep in mind, that we hide the backButton and breadcrumbs.

previews/primer/open_project/page_header_preview.rb Outdated Show resolved Hide resolved
previews/primer/open_project/page_header_preview.rb Outdated Show resolved Hide resolved
@dominic-braeunlein
Copy link
Author

... and saw that there are some special mobile styles: The back button is hidden, as well as the breadcumb and a different navigation element is shown. In Primer, this is named the context bar of the page header. We can add that in a separate PR to get this one done, but need to keep in mind, that we hide the backButton and breadcrumbs.

Hi @HDinger
Perfect, I will create a new PR for that.

After I added the new parameters to the playground I saw a small misalignment:
The back button (even when set to large) doesn't align perfectly when the title is set to large .
I would look further into this if you think it is necessary. I just didn't find an obvious fix for it. What do you think?

Also, thank you for all your input!

Screenshot 2023-11-08 at 18 30 33

@opf opf deleted a comment from github-actions bot Nov 8, 2023
@opf opf deleted a comment from github-actions bot Nov 8, 2023
@opf opf deleted a comment from github-actions bot Nov 8, 2023
@opf opf deleted a comment from github-actions bot Nov 8, 2023
@HDinger
Copy link
Collaborator

HDinger commented Nov 9, 2023

After I added the new parameters to the playground I saw a small misalignment:
The back button (even when set to large) doesn't align perfectly when the title is set to large .
I would look further into this if you think it is necessary. I just didn't find an obvious fix for it. What do you think?

Yeah, I would like to have that solved. I can support you with this, if you like.

…misalignment which we have to cancel out. This is most likely coming from the arrow being thinner than the font
Copy link
Collaborator

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Good to merge 👍 Thanks for all the effort @dominic-braeunlein !

@HDinger HDinger merged commit ac9f727 into main Nov 9, 2023
25 checks passed
@HDinger HDinger deleted the add-back-and-breadcrumbs-to-page-header branch November 9, 2023 09:21
@openprojectci openprojectci mentioned this pull request Nov 9, 2023
Copy link

Uh oh! @dominic-braeunlein, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

1 similar comment
Copy link

Uh oh! @dominic-braeunlein, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants