);
})}
{scrollable && (
)}
);
};
Slider.propTypes = {
slides: PropTypes.arrayOf(PropTypes.node.isRequired),
breakpoints: PropTypes.arrayOf(
PropTypes.shape({
/**
* Breakpoint name as defined in Tailwind config. If not defined, config
* will be applied to all non-configured screen sizes.
*/
name: PropTypes.string,
/**
* Number of slides visible for a given breakpoint.
*/
visibleSlides: PropTypes.number.isRequired,
/**
* Whether or not the list should be scrollable horizontally at the given breakpoint.
* If set to false, all slides will be visible & rendered in a column.
*/
scrollable: PropTypes.bool.isRequired,
/**
* Additional class names to apply to the element.
*/
scrollerClassName: PropTypes.string,
/**
* Additional class names to apply to the element.
*/
className: PropTypes.string,
})
),
};
Slider.defaultProps = {
breakpoints: [
{
name: "xl",
scrollable: true,
visibleSlides: 3,
},
{
name: "md",
scrollable: true,
visibleSlides: 2,
},
{
// For the smallest screens, we won't scroll but instead stack the slides vertically.
scrollable: false,
visibleSlides: 1,
},
],
scrollerClassName: "gap-4",
className: "",
};
export default Slider;