@@ -37,14 +37,22 @@ type Props = {
3737 emptyContentTitle : string ,
3838 paginationSize : number ,
3939 onLoadMoreReviews : Function ,
40- showLoadMore : ?boolean
40+ showLoadMore : ?boolean ,
4141} ;
4242
4343type 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