1 | import React from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import classNames from 'classnames';
|
4 | import { mapToCssModules, tagPropType } from './utils';
|
5 |
|
6 | const propTypes = {
|
7 | active: PropTypes.bool,
|
8 | children: PropTypes.node,
|
9 | className: PropTypes.string,
|
10 | cssModule: PropTypes.object,
|
11 | disabled: PropTypes.bool,
|
12 | tag: tagPropType,
|
13 | };
|
14 |
|
15 | const defaultProps = {
|
16 | tag: 'li',
|
17 | };
|
18 |
|
19 | const PaginationItem = (props) => {
|
20 | const {
|
21 | active,
|
22 | className,
|
23 | cssModule,
|
24 | disabled,
|
25 | tag: Tag,
|
26 | ...attributes
|
27 | } = props;
|
28 |
|
29 | const classes = mapToCssModules(classNames(
|
30 | className,
|
31 | 'page-item',
|
32 | {
|
33 | active,
|
34 | disabled,
|
35 | }
|
36 | ), cssModule);
|
37 |
|
38 | return (
|
39 | <Tag {...attributes} className={classes} />
|
40 | );
|
41 | };
|
42 |
|
43 | PaginationItem.propTypes = propTypes;
|
44 | PaginationItem.defaultProps = defaultProps;
|
45 |
|
46 | export default PaginationItem;
|