UNPKG

wix-style-react

Version:
45 lines (41 loc) 1.59 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["dataHook", "arrowSize", "buttonSkin", "icon", "className", "controlsStartEnd"]; import React from 'react'; import PropTypes from 'prop-types'; import IconButton from '../../IconButton/IconButton'; import { classes } from '../Carousel.st.css'; var skinPriorityMap = { standard: 'secondary', inverted: 'primary', light: 'primary', transparent: 'primary', premium: 'primary' }; var SliderArrow = function SliderArrow(_ref) { var dataHook = _ref.dataHook, arrowSize = _ref.arrowSize, buttonSkin = _ref.buttonSkin, icon = _ref.icon, className = _ref.className, controlsStartEnd = _ref.controlsStartEnd, remainingProps = _objectWithoutProperties(_ref, _excluded); var isControlOnEdge = className.includes('slick-disabled'); return isControlOnEdge && controlsStartEnd === 'hidden' ? null : /*#__PURE__*/React.createElement("div", _extends({}, remainingProps, { "data-hook": dataHook, className: className }), /*#__PURE__*/React.createElement(IconButton, { className: classes.controls, skin: buttonSkin, size: arrowSize, disabled: isControlOnEdge, priority: skinPriorityMap[buttonSkin] }, icon)); }; SliderArrow.propTypes = { /** Applied as data-hook HTML attribute that can be used in the tests */ dataHook: PropTypes.string, /** Icon to be rendered within the icon button */ icon: PropTypes.element.isRequired }; export default SliderArrow;