Skip to content

Commit 9b4515c

Browse files
author
Eugene Glova
committed
Add reviews to styleguidist
1 parent f44af9c commit 9b4515c

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"result":[{"sku":"288022_760","id":5,"archivedAt":null,"scope":"1","updatedAt":"2017-05-26T20:26:04.306Z","title":null,"createdAt":"2017-05-26T20:26:04.306Z","attributes":{"status":{"t":"string","v":"pending"},"imageUrl":{"t":"string","v":"http:\/\/demandware.edgesuite.net\/sits_pod20-adidas\/dw\/image\/v2\/aaqx_prd\/on\/demandware.static\/-\/Sites-adidas-products\/en_US\/dwa2a8fa86\/zoom\/288022_01_standard.jpg"},"productName":{"t":"string","v":"adilette Slides"}},"rating":null,"userId":"7","userName":"tester"}],"pagination":{"total":1},"max_score":0}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"result":[{"sku":"BW0549_620","id":2,"archivedAt":null,"scope":"1","updatedAt":"2017-05-26T00:43:23.394Z","title":"Something about these shoes","createdAt":"2017-05-26T00:41:16.228Z","attributes":{"status":{"t":"string","v":"submitted"},"body":{"t":"string","v":"They didn't quite fit my feet so I'm thinking about asking for a refund."},"title":{"t":"string","v":"Something about these shoes"}},"rating":null,"userId":"9","userName":"test tester"},{"sku":"BW0549_620","id":1,"archivedAt":null,"scope":"1","updatedAt":"2017-05-25T23:37:13.616Z","title":"Testing writing a review through pure","createdAt":"2017-05-25T23:00:25.272Z","attributes":{"title":{"t":"string","v":"Testing writing a review through pure"},"status":{"t":"string","v":"submitted"},"body":{"t":"string","v":"My review of these shoes would help no one."},"imageUrl":{"t":"string","v":"http:\/\/demandware.edgesuite.net\/sits_pod20-adidas\/dw\/image\/v2\/aaqx_prd\/on\/demandware.static\/-\/Sites-adidas-products\/default\/dw3c2f754d\/zoom\/BW0549_01_standard.jpg"},"productName":{"t":"string","v":"Harden Vol. 1 \"No Brakes\" Shoes"}},"rating":null,"userId":"7","userName":"tester"}],"pagination":{"total":2},"max_score":0}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#### Example
2+
3+
##### Sample reviews
4+
5+
```
6+
<div style={{maxWidth: '1080px'}}>
7+
<ProductReviewsList
8+
title="Reviews"
9+
emptyContentTitle="There are no reviews for this product"
10+
listItems={sampleProductReviews.result}
11+
isLoading={false}
12+
paginationSize={5}
13+
onLoadMoreReviews={()=>{alert('load more')}}
14+
showLoadMore={_.size(sampleProductReviews.result) < sampleProductReviews.pagination.total}
15+
/>
16+
</div>
17+
```
18+
##### No reviews or only pending reviews
19+
20+
```
21+
<div style={{maxWidth: '1080px'}}>
22+
<ProductReviewsList
23+
title="Reviews"
24+
emptyContentTitle="There are no reviews for this product"
25+
listItems={sampleProductReviewsPending.result}
26+
isLoading={false}
27+
paginationSize={5}
28+
onLoadMoreReviews={()=>{alert('load more')}}
29+
showLoadMore={_.size(sampleProductReviewsPending.result) < sampleProductReviewsPending.pagination.total}
30+
/>
31+
</div>
32+
```

styleguide.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module.exports = {
2020
context: {
2121
sampleProduct: path.resolve(__dirname, 'fixtures/sample-product.json'),
2222
sampleRelatedProducts: path.resolve(__dirname, 'fixtures/sample-related-products.json'),
23+
sampleProductReviews: path.resolve(__dirname, 'fixtures/sample-product-reviews.json'),
24+
sampleProductReviewsPending: path.resolve(__dirname, 'fixtures/sample-product-reviews-pending.json'),
2325
},
2426
sections: [
2527
{
@@ -46,6 +48,7 @@ module.exports = {
4648
components: () => ([
4749
path.resolve(__dirname, 'src/components/pdp/pdp.jsx'),
4850
path.resolve(__dirname, 'src/components/related-products-list/related-products-list.jsx'),
51+
path.resolve(__dirname, 'src/components/product-reviews-list/product-reviews-list.jsx'),
4952
]),
5053
},
5154
],

0 commit comments

Comments
 (0)