Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PB-3722): update Carousel to allow custom vertical slide padding #1527

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "pcln-carousel",
"comment": "add slidePaddingY prop for custom vertical padding on slides",
"type": "minor"
}
],
"packageName": "pcln-carousel"
}
5 changes: 4 additions & 1 deletion packages/carousel/src/Carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const Carousel = ({
visibleSlides = 1,
arrowsPosition = 'side',
slideSpacing = 2,
slidePaddingY = slideSpacing,
onSlideChange,
sideButtonMargin = '-30px',
sidePositionArrowButton,
Expand Down Expand Up @@ -180,7 +181,7 @@ export const Carousel = ({
onSlideChange={onSlideChange}
displayArrowsMobile={displayArrowsMobile}
>
<Box p={slideSpacing} height='100%'>
<Box p={slideSpacing} py={slidePaddingY} height='100%'>
{!layout && stretchSlideHeight
? React.cloneElement(item, { style: { 'min-height': '100%' } })
: item}
Expand Down Expand Up @@ -284,6 +285,8 @@ Carousel.propTypes = {
arrowsPosition: PropTypes.oneOf(['side', 'top', 'bottom', 'hide']),
/** Padding around the slides */
slideSpacing: PropTypes.number,
/** Vertical padding for the slides */
slidePaddingY: PropTypes.number,
/** Custom arrow button margin for side position/horizontal orientation */
sideButtonMargin: PropTypes.string,
/** Called each time the current slide changes, passed the new currentSlide (zero-indexed) */
Expand Down
Loading