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 |
|
8 | active: PropTypes.bool,
|
9 | children: PropTypes.node,
|
10 |
|
11 | className: PropTypes.string,
|
12 |
|
13 | cssModule: PropTypes.object,
|
14 |
|
15 | disabled: PropTypes.bool,
|
16 |
|
17 | tag: tagPropType,
|
18 | };
|
19 |
|
20 | function PaginationItem(props) {
|
21 | const {
|
22 | active,
|
23 | className,
|
24 | cssModule,
|
25 | disabled,
|
26 | tag: Tag = 'li',
|
27 | ...attributes
|
28 | } = props;
|
29 |
|
30 | const classes = mapToCssModules(
|
31 | classNames(className, 'page-item', {
|
32 | active,
|
33 | disabled,
|
34 | }),
|
35 | cssModule,
|
36 | );
|
37 |
|
38 | return <Tag {...attributes} className={classes} />;
|
39 | }
|
40 |
|
41 | PaginationItem.propTypes = propTypes;
|
42 |
|
43 | export default PaginationItem;
|
44 |
|
\ | No newline at end of file |