Skip to content

Commit

Permalink
Optional rating (#37805)
Browse files Browse the repository at this point in the history
  • Loading branch information
processprocess authored Mar 1, 2022
1 parent 92cfd7b commit 94048f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
5 changes: 0 additions & 5 deletions examples/amp-story/amp-story-shopping.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@
"productPrice": 1200.00,
"productPriceCurrency": "INR",
"productImages": [{"url": "https://source.unsplash.com/BdVQU-NDtA8/500x500", "alt": "art"}],
"aggregateRating": {
"ratingValue": 4.4,
"reviewCount": 89,
"reviewUrl": "https://www.google.com"
},
"productDetails": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere error deserunt dignissimos in laborum ea molestias veritatis sint laudantium iusto expedita atque provident doloremque, ad voluptatem culpa adipisci. Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere error deserunt dignissimos in laborum ea molestias veritatis sint laudantium iusto expedita atque provident doloremque, ad voluptatem culpa adipisci."
},
{
Expand Down
32 changes: 17 additions & 15 deletions extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,23 @@ export class AmpStoryShoppingAttachment extends AMP.BaseElement {
)}
</span>
</div>
<span class="i-amphtml-amp-story-shopping-pdp-reviews">
{activeProductData.aggregateRating.ratingValue} (
<a
class="i-amphtml-amp-story-shopping-pdp-reviews-link"
href={activeProductData.aggregateRating.reviewUrl}
target="_top"
>
{activeProductData.aggregateRating.reviewCount + ' '}
{this.localizationService_.getLocalizedString(
LocalizedStringId_Enum.AMP_STORY_SHOPPING_ATTACHMENT_REVIEWS_LABEL,
this.element
)}
</a>
)
</span>
{activeProductData.aggregateRating && (
<span class="i-amphtml-amp-story-shopping-pdp-reviews">
{activeProductData.aggregateRating.ratingValue} (
<a
class="i-amphtml-amp-story-shopping-pdp-reviews-link"
href={activeProductData.aggregateRating.reviewUrl}
target="_top"
>
{activeProductData.aggregateRating.reviewCount + ' '}
{this.localizationService_.getLocalizedString(
LocalizedStringId_Enum.AMP_STORY_SHOPPING_ATTACHMENT_REVIEWS_LABEL,
this.element
)}
</a>
)
</span>
)}
<a
class="i-amphtml-amp-story-shopping-pdp-cta"
href={activeProductData.productUrl}
Expand Down

0 comments on commit 94048f9

Please sign in to comment.