@arranjae/react-simple-carousel
Version:
Simple Carousel - React and TypeScript
18 lines • 881 B
JavaScript
import React, { useEffect } from 'react';
import classnames from 'classnames';
export var SimpleCarouselItem = function (props) {
var item = props.item, refer = props.refer;
var thisRef = React.useRef();
useEffect(function () {
refer(thisRef);
}, [thisRef, refer]);
return (React.createElement("div", { ref: thisRef, className: classnames("simple-carousel-item", item.itemCustomClass), onClickCapture: function (e) {
var _a, _b;
e.persist();
thisRef.current.scrollIntoView({ behavior: 'smooth', inline: 'center' });
(_a = props.setScroll) === null || _a === void 0 ? void 0 : _a.call(props);
(_b = item.onClickItem) === null || _b === void 0 ? void 0 : _b.call(item, e, thisRef);
} }, item.content));
};
export default SimpleCarouselItem;
//# sourceMappingURL=SimpleCarouselItem.js.map