Pager.js 1.13 KB
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

/* eslint react/prop-types: 0 */
import React from 'react';
import classNames from 'classnames';

var Pager = function Pager(props) {
  var _classNames;

  var prefixCls = "".concat(props.rootPrefixCls, "-item");
  var cls = classNames(prefixCls, "".concat(prefixCls, "-").concat(props.page), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-active"), props.active), _defineProperty(_classNames, props.className, !!props.className), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), !props.page), _classNames));

  var handleClick = function handleClick() {
    props.onClick(props.page);
  };

  var handleKeyPress = function handleKeyPress(e) {
    props.onKeyPress(e, props.onClick, props.page);
  };

  return /*#__PURE__*/React.createElement("li", {
    title: props.showTitle ? props.page : null,
    className: cls,
    onClick: handleClick,
    onKeyPress: handleKeyPress,
    tabIndex: "0"
  }, props.itemRender(props.page, 'page', /*#__PURE__*/React.createElement("a", {
    rel: "nofollow"
  }, props.page)));
};

export default Pager;