-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only load review listing components if reviews are available (#8)
- Loading branch information
1 parent
55946a2
commit 4f2a008
Showing
1 changed file
with
22 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
<graphql v-cloak query='@include('rapidez-reviews::queries.reviews', @compact('sku'))'> | ||
<div slot-scope="{ data }" v-if="data?.products.items[0].reviews"> | ||
<strong class="block text-2xl mt-5">@lang('Customer Reviews')</strong> | ||
<div itemprop="aggregateRating" itemtype="https://schema.org/AggregateRating" itemscope> | ||
<meta itemprop="reviewCount" content="{{ $reviews_count }}" /> | ||
<meta itemprop="ratingValue" content="{{ $reviews_score }}" /> | ||
<meta itemprop="bestRating" content="100" /> | ||
</div> | ||
<div v-for="review in data.products.items[0].reviews.items" class="w-full bg-gray-200 rounded p-3 mt-3" itemprop="review" itemtype="https://schema.org/Review" itemscope> | ||
<p class="flex items-baseline" itemprop="author" itemtype="https://schema.org/Person" itemscope> | ||
<strong itemprop="name">@{{ review.nickname }}</strong> | ||
<span class="ml-2 text-xs">@{{ new Date(review.created_at).toLocaleDateString() }}</span> | ||
</p> | ||
<div itemprop="reviewRating" itemtype="https://schema.org/Rating" itemscope> | ||
<meta itemprop="ratingValue" v-bind:content="review.average_rating" /> | ||
@if($reviews_score) | ||
<graphql v-cloak query='@include('rapidez-reviews::queries.reviews', @compact('sku'))'> | ||
<div slot-scope="{ data }" v-if="data?.products.items[0].reviews"> | ||
<strong class="block text-2xl mt-5">@lang('Customer Reviews')</strong> | ||
<div itemprop="aggregateRating" itemtype="https://schema.org/AggregateRating" itemscope> | ||
<meta itemprop="reviewCount" content="{{ $reviews_count }}" /> | ||
<meta itemprop="ratingValue" content="{{ $reviews_score }}" /> | ||
<meta itemprop="bestRating" content="100" /> | ||
<stars class="mt-1" v-bind:score="review.average_rating"></stars> | ||
</div> | ||
<strong class="block mt-3" itemprop="name">@{{ review.summary }}</strong> | ||
<p class="mt-1 text-sm" itemprop="reviewBody">@{{ review.text }}</p> | ||
<div v-for="review in data.products.items[0].reviews.items" class="w-full bg-gray-200 rounded p-3 mt-3" itemprop="review" itemtype="https://schema.org/Review" itemscope> | ||
<p class="flex items-baseline" itemprop="author" itemtype="https://schema.org/Person" itemscope> | ||
<strong itemprop="name">@{{ review.nickname }}</strong> | ||
<span class="ml-2 text-xs">@{{ new Date(review.created_at).toLocaleDateString() }}</span> | ||
</p> | ||
<div itemprop="reviewRating" itemtype="https://schema.org/Rating" itemscope> | ||
<meta itemprop="ratingValue" v-bind:content="review.average_rating" /> | ||
<meta itemprop="bestRating" content="100" /> | ||
<stars class="mt-1" v-bind:score="review.average_rating"></stars> | ||
</div> | ||
<strong class="block mt-3" itemprop="name">@{{ review.summary }}</strong> | ||
<p class="mt-1 text-sm" itemprop="reviewBody">@{{ review.text }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</graphql> | ||
</graphql> | ||
@endif |