Skip to content

Commit

Permalink
Add "infinite" property to make the related producs shelf able to be …
Browse files Browse the repository at this point in the history
…not infinite
  • Loading branch information
efremov-av committed Sep 26, 2024
1 parent fe7faeb commit 1535601
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions react/components/ProductList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const ProductList = ({
paginationDotsVisibility,
navigationStep: navigationStepProp,
trackingId,
infinite,
}) => {
const handles = useCssHandles(CSS_HANDLES)
const navigationStep = Number.isNaN(parseInt(navigationStepProp, 10))
Expand Down Expand Up @@ -77,6 +78,7 @@ const ProductList = ({
minItemsPerPage={minItemsPerPage}
paginationDotsVisibility={paginationDotsVisibility}
listName={listName}
infinite={infinite}
/>
)}
</ReactResizeDetector>
Expand All @@ -95,6 +97,7 @@ ProductList.defaultProps = {
showTitle: true,
titleText: null,
isMobile: false,
infinite: true,
}

ProductList.propTypes = {
Expand All @@ -112,6 +115,7 @@ ProductList.propTypes = {
'mobileOnly',
]),
trackingId: PropTypes.string,
infinite: PropTypes.bool,
...productListSchemaPropTypes,
}

Expand Down
5 changes: 4 additions & 1 deletion react/components/ShelfContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class ShelfContent extends Component {
minItemsPerPage,
paginationDotsVisibility,
listName,
infinite,
} = this.props

const { currentSlide } = this.state
Expand All @@ -170,7 +171,7 @@ class ShelfContent extends Component {
className={`${cssHandles.sliderContainer} w-100 mw9`}
>
<Slider
loop
loop={infinite}
easing="ease"
duration={500}
minPerPage={roundedMinItems}
Expand Down Expand Up @@ -257,6 +258,8 @@ ShelfContent.propTypes = {
gap: shelfContentPropTypes.gap,
/** Title of the shelf */
listName: shelfContentPropTypes.listName,
/** Is infinite */
infinite: shelfContentPropTypes.infinite,
}

export default withCssHandles(CSS_HANDLES)(ShelfContent)
2 changes: 2 additions & 0 deletions react/utils/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,6 @@ export const shelfContentPropTypes = {
gap: PropTypes.oneOf(getGapPaddingValues()),
/** Title of the shelf */
listName: PropTypes.string.isRequired,
/** Is infinite */
infinite: PropTypes.bool,
}

0 comments on commit 1535601

Please sign in to comment.