Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[feature]: product page breadcrumbs #1960

Merged
merged 14 commits into from
Nov 14, 2019
Merged

Conversation

sirugh
Copy link
Contributor

@sirugh sirugh commented Nov 5, 2019

Description

Based on #1949. This PR adds breadcrumbs to the product page. Main differences:

  • Unlike the category page breadcrumbs, the last category text in the list is a link and will be underlined/clickable.
  • If a product has only one related category it will display a single breadcrumb to that category
  • If a product has multiple categories it will display a dropdown with multiple options.

Related Issue

Closes PWA-99.

Acceptance

Verification Stakeholders

@jimbo @schensley

  • Should we even display PDP breadcrumbs on mobile?
  • Is a dropdown the right UX?

Specification

Verification Steps

  1. Go to a product with only one related category (isadora skirt). It should show regular breadcrumbs like on the category page.
  2. Go to a product with multiple categories (valeria two-layer tank). It should also show regular breadcrumbs.

Screenshots / Screen Captures (if appropriate)

Image from Gyazo

Image from Gyazo

Checklist

  • I have updated the documentation accordingly, if necessary.
  • I have added tests to cover my changes, if necessary.

@sirugh sirugh changed the base branch from develop to rugh/breadcrumbs November 5, 2019 16:12
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Nov 5, 2019

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-99.

Generated by 🚫 dangerJS against 965d313

@sirugh sirugh added Don't Merge version: Minor This changeset includes functionality added in a backwards compatible manner. labels Nov 5, 2019
@sirugh sirugh changed the base branch from rugh/breadcrumbs to develop November 12, 2019 20:17
@sirugh sirugh changed the base branch from develop to rugh/breadcrumbs November 12, 2019 20:17
@sirugh sirugh force-pushed the rugh/product-breadcrumbs branch from 18b3479 to 73f994c Compare November 12, 2019 21:04
@sirugh sirugh changed the base branch from rugh/breadcrumbs to develop November 12, 2019 21:04
@sirugh
Copy link
Contributor Author

sirugh commented Nov 12, 2019

I just pushed some big changes to this PR. Rather than have a dropdown for breadcrumbs when there were multiple possible categories on a PDP I now:

  1. Request categories for the product
  2. Filter down the category breadcrumbs to a list of only leaf categories since the API gives us all the intermediate categories.
  3. Select the first category id as the breadcrumb category for the product.

Note that the method of selection of which category breadcrumbs to display can cause a jarring display if a user navigated to the PDP by one route and are then shown a different breadcrumb set. See the gifs in the description.


// Return the first category id of the potential leaf categories.
// This can potentially be jarring if the user navigated to a product and
// the breadcrumbs don't represent that navigation path.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it'll be jarring at all. Breadcrumbs should be a canonical path to the product as understood by the server (or in this case, estimated by the client using a simple heuristic: first category wins). We don't need to be in the business of showing the user their navigation history. That's what browser history and browser chrome are for.

At any rate, I like this a lot more than the dropdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I certainly don't want to lead opinion through this comment -- I can remove it and simply say "Until we can get the single canonical breadcrumb path to a product we will just select the first leaf category"

@sirugh sirugh force-pushed the rugh/product-breadcrumbs branch from ffd13b4 to a13fbe2 Compare November 12, 2019 21:58
@@ -1,5 +1,11 @@
fragment ProductDetails on ProductInterface {
__typename
categories {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As an FYI we should add a comment in here at the top saying that updates to this fragment should be mirrored in getProductDetail and vice versa.

<Breadcrumbs
categoryId={breadcrumbCategoryId}
currentProduct={productDetails.name}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and the returned prop are the only changes. Everything just shifted cause of the <Fragment>.

Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Looks great, have some minor suggestions for optimization and readability.

tjwiebell
tjwiebell previously approved these changes Nov 14, 2019
Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Hansel and Gretel would be proud, nice work 🍞 🍞 🍞

Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

@dpatil-magento dpatil-magento merged commit 1c5a422 into develop Nov 14, 2019
@dpatil-magento dpatil-magento deleted the rugh/product-breadcrumbs branch November 14, 2019 19:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pkg:peregrine pkg:venia-ui version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants