Skip to content

Commit 52eff8b

Browse files
committed
Changes for product-reviews storefront code
1 parent 2da2681 commit 52eff8b

2 files changed

Lines changed: 27 additions & 16 deletions

File tree

src/components/product-reviews-list/product-reviews-list.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
}
2929

3030
.product-review-container {
31-
border: 1px solid #DDDDDD;
31+
border: 1px solid var(--alto);
3232
border-radius: 4px;
33-
padding: 12px 15px 12px 15px;
33+
padding: 12px 15px;
3434
margin-top: 32px;
3535
}
3636

@@ -41,7 +41,7 @@
4141
.product-review-title {
4242
font-size: 22px;
4343
font-weight: 900;
44-
color: #222222;
44+
color: var(--blackish);
4545
}
4646

4747
.product-review-name-date {

src/components/product-reviews-list/product-reviews-list.jsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,22 @@ type Props = {
3737
emptyContentTitle: string,
3838
paginationSize: number,
3939
onLoadMoreReviews: Function,
40-
showLoadMore: ?boolean
40+
showLoadMore: ?boolean,
4141
};
4242

4343
type State = {
4444
page: number,
4545
}
4646

47-
const ReviewBody = (props): Element<any> => {
47+
type ReviewBodyProps = {
48+
title: string,
49+
userName: string,
50+
updatedAt: string,
51+
sku: string,
52+
body: string,
53+
};
54+
55+
const ReviewBody = (props: ReviewBodyProps): Element<any> => {
4856
const { title, userName, updatedAt, sku, body } = props;
4957
const updatedAtFormatted = moment(updatedAt).format('MMM Do YYYY');
5058

@@ -106,6 +114,19 @@ class ProductReviewsList extends Component {
106114
);
107115
}
108116

117+
get loadMoreActionsLink(): ?Element<any> {
118+
const { showLoadMore } = this.props;
119+
return (showLoadMore)
120+
? (
121+
<ActionLink
122+
action={this.handleLoadMoreReviews}
123+
title="LOAD MORE REVIEWS"
124+
styleName="product-review-load-more"
125+
/>
126+
)
127+
: null;
128+
}
129+
109130
get displayReviews(): ?Element<any> {
110131
const { listItems, showLoadMore } = this.props;
111132
const reviews = _.map(listItems, (review) => {
@@ -121,20 +142,10 @@ class ProductReviewsList extends Component {
121142
);
122143
});
123144

124-
const loadMoreActionLink = (showLoadMore)
125-
? (
126-
<ActionLink
127-
action={this.handleLoadMoreReviews}
128-
title="LOAD MORE REVIEWS"
129-
styleName="product-review-load-more"
130-
/>
131-
)
132-
: null;
133-
134145
return (
135146
<div>
136147
{reviews}
137-
{loadMoreActionLink}
148+
{this.loadMoreActionsLink}
138149
</div>
139150
);
140151
}

0 commit comments

Comments
 (0)