reactioncommerce / example-storefront

Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
https://www.mailchimp.com/developer/open-commerce
Apache License 2.0
606 stars 288 forks source link

Use Price component from library in product grid #147

Closed aldeed closed 6 years ago

aldeed commented 6 years ago

Work

A new Price component was created in the component library for CartItem. It's the same as the way the price and compareAtPrice is displayed in the product grid, so switch the product grid to use this new component.

kieckhafer commented 6 years ago

@aldeed

Is this new component only supposed to show the price range?

I'm trying to also provide the compareAtPrice, but it looks like we'll need to refactor how the data is passed if we are going to do that.

compareAtPrice is never on the product itself, it's only on variants, so when we convert a Product schema product to a Catalog schema product, this data will never be there, as we are trying to get it off the top level product: https://github.com/reactioncommerce/reaction/blob/release-1.14.0/imports/plugins/core/catalog/server/no-meteor/utils/publishProductToCatalog.js#L172

aldeed commented 6 years ago

@kieckhafer Hmm, maybe we don't need to do this. I forgot about that, and if grid is only showing a single string generated on the server right now, I guess we don't benefit much from using this component. I guess we should close this?

kieckhafer commented 6 years ago

@aldeed There is a PR ready to go, but it's minimal updates: https://github.com/reactioncommerce/reaction-next-starterkit/pull/156

It just installs the component library and uses the Price component on one line.

Might be good to leave it as an example of importing the component library, or could also be taken out until the component is more robust. Whatever you think is best.