UNPKG

2.35 kBJavaScriptView Raw
1var _excluded = ["active", "className", "cssModule", "disabled", "tag"];
2function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5import React from 'react';
6import PropTypes from 'prop-types';
7import classNames from 'classnames';
8import { mapToCssModules, tagPropType } from './utils';
9var propTypes = {
10 /** Set item as active */
11 active: PropTypes.bool,
12 children: PropTypes.node,
13 /** Add custom class */
14 className: PropTypes.string,
15 /** Change underlying component's CSS base class name */
16 cssModule: PropTypes.object,
17 /** Set item as disabled */
18 disabled: PropTypes.bool,
19 /** Set a custom element for this component */
20 tag: tagPropType
21};
22function PaginationItem(props) {
23 var active = props.active,
24 className = props.className,
25 cssModule = props.cssModule,
26 disabled = props.disabled,
27 _props$tag = props.tag,
28 Tag = _props$tag === void 0 ? 'li' : _props$tag,
29 attributes = _objectWithoutProperties(props, _excluded);
30 var classes = mapToCssModules(classNames(className, 'page-item', {
31 active: active,
32 disabled: disabled
33 }), cssModule);
34 return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
35 className: classes
36 }));
37}
38PaginationItem.propTypes = propTypes;
39export default PaginationItem;
\No newline at end of file